Fetching the Return results of a spawned Thread
Fredrik Lundh
fredrik at pythonware.com
Tue Feb 28 04:42:43 EST 2006
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>
More information about the Python-list
mailing list