threading

Peter Hansen peter at engcorp.com
Wed May 29 00:59:39 EDT 2002


Magnus wrote:
> 
> Thanks for the suggestion. I will try that and see if it works. My concern
> is that one thread might be e.g. writing to a file, and in that case I need
> to way for it to finish. By using a flag this should work.

1. If the thread is waiting for an operation such as writing to a file,
you have no choice but to let it time out and then check the flag.  
There is no way to force a thread to terminate.

> (I am thinking about setting up a signal handler that changes the flags in
> all threads.)

2. See the notes in the docs for the signal module.  I believe it says
they are sent only to the main thread.


-Peter



More information about the Python-list mailing list