[Tutor] Queued threads
Bernard Lebel
python at bernardlebel.com
Wed Feb 16 02:58:15 CET 2005
Hello,
I have already messed a little with simple thread programming, wich took
this form:
from threading import Thread
def mainFunction():
pass
Thread( target=mainFunction ).start()
Now, I have a list of "jobs", each job being a windows bat file that
launches an executable and performs a rendering task. So I have this
queue of jobs, and would like to launch one only when the previous one
has finished, and in a separate window. So far I have not been having
much success with simple stuff:
from threading import Thread
def mainFunction():
print 'function print'
return 1
for i in range( 0, 3 ):
oThread = Thread( target=mainFunction ).start()
if oThread == 1:
print 'sleeping 3 seconds'
time.sleep( 3 )
In this example, 'sleeping 3 seconds' not returned, and each thread is
started without any waiting.
I'm looking at the various threading module details in the library but I
have to admit that, well, I'm a bit at loss here.
Thanks in advance
Bernard
More information about the Tutor
mailing list