Is there any method by which I can join() to a group of threads instead of a single one?

Alex Chaffee

Yes. Just join to each one in turn. That way, when the loop exits, you know that all the threads have exited -- whether it was the first thread or the seventh thread that took the longest, all threads will be waited for. Remember, join() on a thread that's already exited takes no time.

Iterator i = myThreads.iterator();
while (i.hasNext()) {
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact