En Thu, 10 Dec 2009 20:43:48 -0300, mattia <ger...@gmail.com> escribió:
Il Thu, 10 Dec 2009 23:10:02 +0000, Matthew Barnett ha scritto:

Only the main thread can receive the keyboard interrupt.

Ok, so is there any way to stop all the threads if the keyboard interrupt
is received?

If all other threads (except the main one) are "daemon" threads, then the whole process finishes when the main thread exits; all daemon threads are abruptly finished. Note that "try/finally" blocks are not honored, neither are "with" statements...

If you want an orderly retreat, the other threads must cooperate (e.g. the main thread sets a flag and they periodically check for it).

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to