problem on waiting exit thread and write on file
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Jun 13 13:45:43 EDT 2007
In <1181749731.260357.192390 at q19g2000prn.googlegroups.com>, Flyzone wrote:
> I need to run in thread a command, one thread for one parameter.
> So i made a for loop, creating 5 threads and waiting their stop with:
> Main {
> open file BW2 for write
> ..... (creating list of thread with a counter)....
> Stopped=False
> while (Stopped == False):
> if not thread5.isAlive():
> if not thread4.isAlive():
> if not thread3.isAlive():
> if not thread2.isAlive():
> if not thread1.isAlive():
> Stopped=True
> if (Stopped == False):
> time.sleep(0.3)
If you create a list with threads where do the names `thread1` to
`thread5` come from? This snippet expects the threads in a list or
another iterable:
for thread in threads:
thread.join()
Much shorter, isn't it!? :-)
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list