Tim Williams (gmail)
tdwdotnet at gmail.com
Tue Jun 29 21:20:02 CEST 2004
On Tue, 29 Jun 2004 14:36:50 -0400, jesso1607 at rogers.com
<jesso1607 at rogers.com> wrote:
> I want to get results from a thread from the main thread. In C I would use pthread_join to wait for the thread and access the result in a paramter I passed to pthread_join.
> In python I can wait with join, but how would you get a result from the thread?
> Thanks for any help,
You could pass the new thread a queue and wait for the new thread to
put something on the queue
q_in = Queue.Queue() #create an inbound queue from the worker threads
w = q_work.get(1) # wait for reply from worker thread
#do something with w
#do something resulting in w
q_in.put(w) # pass reply back to queuethread
More information about the Python-list