Popular Posts

Saturday, July 16, 2011

JAVA - join() Method

When non-static join() method is invoked it will make currently running thread to wait until the invoking thread finished its execution.


 
Here th[i].join() will make main thread to wait until it is finished. So,
 
main--->
             th[0].join()---> 
                                  main-->
                                             th[1].join()---> 
                                                                  main-->
                                                                             th[2].join()--->   
                                                                                                   main---->
 
Thus join() method makes to Join the current thread after 
it goes to dead state.

No comments:

Post a Comment