Idle wait for outstanding threads?

Aahz Maruch aahz at panix.com
Thu Jan 31 16:06:07 EST 2002


In article <f72dac0d.0201310341.2b52f42e at posting.google.com>,
Alan Kennedy <alanmk at hotmail.com> wrote:
>
>def serviceRequest(req):
>    # Task: Carry out database query 1
>    # Task: Carry out database query 2
>    # Task: Carry out database query 3
>    # Task: Carry out some complex calculations
>    # Collate the results and prepare the reply
>
>Now all of the tasks carried out above are independent, so they can be
>executed in parallel. So I hope to speed things up by creating a
>thread for each one. Obviously, I have to wait until all of the tasks
>are finished before I collate the results and prepare the reply.

Then, yeah, thread.join() is best.  Note that parallelizing calculations
will not gain you anything.
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"The more you drive, the less intelligent you are."  --_Repo Man_



More information about the Python-list mailing list