| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#2 (permalink) |
|
Member
Join Date: Sep 2006
Posts: 40
Thanks: 0 Thanked 4 Times in 3 Posts Thanks: 0
Thanked 4 Times in 3 Posts
Rep Power: 5
|
Re: thread - join()
Hi
When the join() method is called, the current thread will simply wait until the thread it is joining with is no longer alive. This can be caused by the thread not having been started, or having been stopped by yet another thread, or by the completion of the thread itself. The join() method basically accomplishes the same task as the combination of the sleep() and isAlive() methods. However, by using the join() method, we accomplish the same task with a single method call. We also have better control over the timeout interval, and we don't have to waste CPU cycles by polling. There are three versions of the join method: void join() Waits for the completion of the specified thread. By definition, join() returns as soon as the thread is considered "not alive". This includes the case in which the join() method is called on a thread that has not been started. void join(long timeout) Waits for the completion of the specified thread, but no longer than the timeout specified in milliseconds. This timeout value is subject to rounding based on the capabilities of the underlying platform. void join(long timeout, int nanoseconds) Waits for the completion of the specified thread, but no longer than a timeout specified in milliseconds and nanoseconds. This timeout value is subject to rounding based on the capabilities of the underlying platform. Regards, Murali |
|
|
|
| The Following User Says Thank You to muralipn For This Useful Post: |
avadhoot.dharmadhikari (29-01-07)
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Thread class Vs Runnable interface | Sudhan | JAVA Technologies | 5 | 24-09-08 08:10 PM |
| OOPS No Thread for AS 400 | shahaan | OTHERS | 0 | 15-10-06 03:13 AM |
| is it the right time to join mainframes | arjun.net | Ask for Suggestion | 2 | 20-03-06 06:40 AM |
| want 2 join mainframes,where | arjun.net | Ask for Suggestion | 2 | 26-02-06 08:50 AM |
| theta join | sandipancse | ORACLE , SQL SERVER , SYBASE & Others | 3 | 09-02-06 07:37 AM |