threading

Magnus spammers.do.not.bother at void.bogus
Wed May 29 11:52:45 EDT 2002


Peter Hansen wrote:

> 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

Thanks Peter. I was reading about it yesterday and it seems to be correct. 
Threading is kind of tricky if one is not familiar with all the cons and 
pros :)

/Magnus




More information about the Python-list mailing list