• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make one thread die before another thread

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1) There are three thread A,B,C. I want thread A to finish its execution after thread B and C completes.How to do it? Each time i am getting different output.

Q2) Is it possiable to make main thread die before thread A,B,C?



 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution would be to chain this up with join(). B->C->A

Is it possiable to make main thread die before thread A,B,C?


Try to make the other threads sleep for a while after they are started by the main thread. What happens ?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amolpalekar kadolkar wrote:Q1) There are three thread A,B,C. I want thread A to finish its execution after thread B and C completes.How to do it? Each time i am getting different output.


Pass those threads(in your case, thread A) to other thread's methods, and call join the thread A in you convenient way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic