Hi Alan,

I have an application that uses a task to continuously read data from a 
> serial device. This task is invoked with "loop.run_until_complete". While 
> this task collecting and interpreting data, it may fire off other tasks. In 
> addition, commands are also arriving from method calls from a user API that 
> fire off other tasks with "run_until_complete". The application runs 
> forever until the user hits "Control C". 
>
> Is there a way for me to cleanly exit (no exceptions or errors) by:
>
> 1. Getting a list of currently running tasks.
> 2. Iterate through that list to cancel the tasks.
> 3. Test that the tasks are cancelled.
> 4. Exit the program.
>
 

I asked a very similar question recently, which can be found here:

https://groups.google.com/d/msg/python-tulip/qQbdxREjn1Q/2VeUfxxy2TsJ

Some people gave nice answers to that, maybe it also helps you.

Greetings

Martin

Reply via email to