Help doing simple threading

Andreas Jung andreas at andreas-jung.com
Thu Mar 15 08:25:00 EST 2001


"David Lees" <deblNonOspammy at theworld.com> schrieb im Newsbeitrag
news:3AB041C6.FDDB84D3 at theworld.com...
> Thanks, these comment were quite helpful.  The most serious error was
> 'a)'.  when I just put the main to sleep after starting up the threads
> it worked fine.  The problem was that I was printing out the array
> values, before all the threads finished executing.

Using sleep() is also dangerous. This is not the way to synchronize threads.
The threading module offers you several possibilites (e.g. join() method)
for
a clean, working solution.

Andreas





More information about the Python-list mailing list