Diez B. Roggisch wrote: > Alex Jurkiewicz wrote: > >> Gabriel Genellina wrote: >>> Try logging the start/stop of your threads. It may be that your >>> threads stop before you think. The above code works correctly only if >>> you fill the queue before starting any thread - because as soon as a >>> thread sees the queue empty, it finishes. >>> You could use the sample code in the Queue documentation at the end of >>> http://docs.python.org/library/queue.htm >> The queue is actually filled before the threads are started, data is >> only removed after they start. >> >> Logging thread state (at least in debug mode) would be good though. How >> would I go about it in this example? The docs suggest using thread.name, >> but in my current setup I don't have any idea which thread is running. >> Something like this: >> for i in range(CONCURRENCY): >> THREADS.append( threading.Thread(target=threadProcessRecipient, >> args=i, name=i) ) >> >> And: >> >> def threadProcessRecipient(name): >> print "Name is %s" % name >
Oh, and I forgot - threading.currentThread() gets you the actively running thread of course. Dize -- http://mail.python.org/mailman/listinfo/python-list