Fetching the Return results of a spawned Thread

2006-02-28 Thread Alvin A. Delagon
Is there any way to fetch the Return results of spawned threads within 
the parent script? I would like to do that because I'm having problems 
with Threads that do queries to a database, I often encounter Threads 
failing due to MySQL connection failures. As much as possible I plan to 
make the threads return the query string and let the parent script do 
the actual query. Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fetching the Return results of a spawned Thread

2006-02-28 Thread Fredrik Lundh
Alvin A. Delagon wrote:

 Is there any way to fetch the Return results of spawned threads within
 the parent script? I would like to do that because I'm having problems
 with Threads that do queries to a database, I often encounter Threads
 failing due to MySQL connection failures. As much as possible I plan to
 make the threads return the query string and let the parent script do
 the actual query. Thanks in advance.

use a shared Queue object, let the worker threads write their result to this
queue, and let the parent thread poll the queue:

http://docs.python.org/lib/module-Queue.html

/F



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fetching the Return results of a spawned Thread

2006-02-28 Thread Kent Johnson
Alvin A. Delagon wrote:
 Is there any way to fetch the Return results of spawned threads within 
 the parent script? 

There are several examples of this in the threading section of the 
Python Cookbook for example
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/435883

Kent
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fetching the Return results of a spawned Thread

2006-02-28 Thread Alvin A. Delagon
Thanks a lot for the links that you gave me. I will look into that 
today!  :-)
-- 
http://mail.python.org/mailman/listinfo/python-list