• Post Reply Bookmark Topic Watch Topic
  • New Topic

concept of join in thread  RSS feed

 
pink yadav
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is join in thread?
 
amitabh mehra
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a thread X, that you want, should only run after thread Z has completed its execution and entered the dead state, then you make thread X to "join" thread Z.
So now, X will not be in runnable state till Z has finished.

Hope this answered your question.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by amitabh mehra:
If you have a thread X, that you want, should only run after thread Z has completed its execution and entered the dead state, then you make thread X to "join" thread Z.
So now, X will not be in runnable state till Z has finished.

Hope this answered your question.


When using states with respect to threads, it is better to use the states as defined by the Thread.State enum. According to that, there is no such state as "Dead" but it is called TERMINATED.
Also, any thread that starts running is said to be in the runnable thread. A thread that has joined with another thread is said to be in WAITING or TIMED_WAITING state based on whether a timed join is used or not.
 
pink yadav
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
amitabh mehra
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i goofed up on the state names... was just trying to explain in general terms... thanks Nitesh.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!