Python - How to cancel a specific task spawned by a nursery in python-trio
问题 I have an async function that listens on a specific port. I want to run the function on a few ports at a time and when the user wants to stop listening on a specific port, stop the function listening on that port. Previously I was using the asyncio library for this task and I tackled this problem by creating tasks with a unique id as their name. asyncio.create_task(Func(), name=UNIQUE_ID) Since trio uses nurseries to spawn tasks, I can see the running tasks by using nursery.child_tasks but