Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mains says :Hey thread jon me !!!  RSS feed

 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, i read that , if we write t1.join() in a main method() where t1 is an instance of thread, then it implies

1. main thread would be moved from Running state to Blocked state with guarantee and would wait for an event of completion of t1 thread.

Problem :- Suppose , i want to say in some thread that join main, then how to do so ???


Thanks !!!
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case that other thread will need the main thread's instance to call join on. Something like this
 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit....
Great explanation !!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!