Jens Müller wrote: > 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. > If you don't need to take anything off the list ever, just create a separate thread that reads items from an output Queue and appends them to the list.
If you *do* take them off, then use a Queue. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list