checking a thread has started
Deepak Sarda
deepak.sarda at gmail.com
Mon Nov 8 02:34:10 EST 2004
On Sun, 07 Nov 2004 09:10:32 GMT, Francesco Bochicchio
<bockman at virgilio.it> wrote:
> I'm not aware of any method in the standard library to do this. But you
> could try using events for this purpose, doing soomething like this:
I tried what you suggested and it works... almost!
This is my thread related code block:
while 1:
t = CreateT( some params)
t.start()
t.actually_started.wait(4.0)
if t.actually_started.isSet():
threadList.append(t)
break
And i loop over the params using this block. Now the whole program
runs and prints the expected output - reaches the last line of code.
But it just doesn't exit! I've tried putting a sys.exit() as well as a
raise SystemExit as the last line - the program still doesn't finish.
Out of the 15 threads, two threads had to be created twice before they
were properly started. I suspect it's due to these dangling threads
that the python interpretor can't exit cleanly. I may be totally wrong
there but that's my guess.
Deepak
--
Online: http://www.antrix.net/journal/
More information about the Python-list
mailing list