Speeding up network access: threading?

Jens Müller me4 at privacy.net
Tue Jan 5 19:45:50 CET 2010


Hi and sorry for double posting - had mailer problems,

> Terry said "queue". not "list". Use the Queue class (it's thread-safe)
> in the "Queue" module (assuming you're using Python 2.x; in Python 3.x
> it's called the "queue" module).

Yes yes, I know. I use a queue to realize the thread pool queue, that works 
all right.

But each worker thread calculates a result and needs to make it avaialable 
to the application in the main thread again. Therefore, it appends its 
result to a common list. This seems works as well, but I was thinking of 
possible conflict situations that maybe could happen when two threads append 
their results to that same result list at the same moment.

Regards,
Jens 




More information about the Python-list mailing list