By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

How can I tell when the threads that I spawn are done in python

P: n/a

Hi,

In my python scripts, I create thread likes this:
// for example threadCount is 10
for j in range(int(threadCount)):
t = MyThread()
t.start()

// wait all the threads are done
doSomething()

My question is how can i tell when all the threads are done before I
call doSomething()?

Thank you.

Mar 24 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mar 24, 9:45 am, "ogerchi...@gmail.com" <ogerchi...@gmail.com>
wrote:
Hi,

In my python scripts, I create thread likes this:
// for example threadCount is 10
for j in range(int(threadCount)):
t = MyThread()
t.start()

// wait all the threads are done
doSomething()

My question is how can i tell when all the threads are done before I
call doSomething()?
If you are using the threading module for your threads, Thread objects
have a join method that you could call. Stash away all your Thread
objects in a list and call join() on all of them.
--
Kushal Kumaran

Mar 24 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.