[Tutor] Queued threads

Bernard Lebel python at bernardlebel.com
Wed Feb 16 03:54:04 CET 2005


That is an attempt to catch the death of the thread. I guess I'm not 
taking the right steps ;-)


Bernard


Liam Clarke wrote:
> I'm sorry, but when does oThread get the value 1?
> 
> If you're testing for it's existence via a True/False thing, try 
> 
> if oThread:
> 
> But otherwise, I'm not sure what you're expecting to get. 
> 
> 
> On Tue, 15 Feb 2005 20:58:15 -0500, Bernard Lebel
> <python at bernardlebel.com> wrote:
> 
>>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