| Author |
Thread join() method
|
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
join() is called on Thread-1(that means, reference a) and called by mainthread.That means mainthread will wait until the thread-1(a) will die. So thread-1 is completed first holding 1 value.then that(1) value is printed for a.i. I wanted to make sure that I got the join() method correctly.Am i correct...
|
 |
Naseem Khan
Ranch Hand
Joined: Apr 25, 2005
Posts: 809
|
|
Yes you are correct. Here, a.join() means main thread will wait for a to complete. By this way, a will successfully assign 1 to i before main thread prints it. Naseem
|
Asking Smart Questions FAQ - How To Put Your Code In Code Tags
|
 |
 |
|
|
subject: Thread join() method
|
|
|