collecting results in threading app

John Nagle nagle at animats.com
Fri Apr 4 19:54:49 CEST 2008


Gerardo Herzig wrote:
> John Nagle wrote:
> 
>> Gerardo Herzig wrote:

> Thanks John, that certanly works. According to George's suggestion, i 
> will take a look to the Queue module.
> One question about
> 
> for mythread in mythreads:        # for all threads
>         mythread.join()            # wait for thread to finish
> 
> 
> That code will wait for the first count(*) to finish and then continues 
> to the next count(*). Because if is that so, it will be some kind of 
> 'use threads, but execute one at the time'.

     No, all the threads are started in the first loop, and can run
their MySQL queries concurrently.  Once all threads have been
started, the second loop (above) waits for all of them to finish.

				John Nagle



More information about the Python-list mailing list