problem on waiting exit thread and write on file

Flyzone flyzone at technologist.com
Fri Jun 15 13:17:36 EDT 2007


Marc 'BlackJack' Rintsch ha scritto:
>     for thread in threads:
>         thread.join()
>
> Much shorter, isn't it!?  :-)

If i do like you tell, all thread will run together right? So i'll get
troubles!
I have a list of hostname, i run a network program and then i need to
write some of the output that give me this command to a file.
If i run the thread together, they can get problems writing on the
same file.
So I have splitted the list in 5 groups, the group 1 have filetmp 1,
group 2 have filetmp 2 and so on...
Then I start one thread for all groups, so 5 threads running together,
the other waiting the end of one of them.




More information about the Python-list mailing list