aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mains says :Hey thread jon me !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "mains says :Hey thread jon me !!!" Watch "mains says :Hey thread jon me !!!" New topic
Author

mains says :Hey thread jon me !!!

Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
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 !!!


SCJP 6.0 96%

(Connecting the Dots ....)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

In that case that other thread will need the main thread's instance to call join on. Something like this


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
Thanks Ankit....
Great explanation !!!
 
 
subject: mains says :Hey thread jon me !!!