Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to check if all threads are finished?  RSS feed

 
Rohit Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
how to check if all threads are finished?

Even i am calling a function which creats a thread.

I wanted to stop at aposition where all other threads are finished.

Can anybody help me?

Thnaks in advance.

Yogesh
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are wanting to exit the whole program when threads have finished, there is nothing to do. That is what Java does anyway.

If you want to wait until a specified set of threads have finished, call join() on them all.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!