Hi, I was looking at the Thread api and one of the interesting thing i have noted in join(long millisecs) method is that ,A time out of 0 means to wait forever. I tried to test this fact using 2 scenarios and as usual i became confused. Scenario 1:
The output is : Am going to sleep I woke up I am main Scenario 2:
The output is : Am going to sleep I woke up I am main My confusion here is: should not that t.join(0) in the Scenario 2 makes the main thread to wait for ever and not printing the I am main at all?. Thanks in advance for any help. Ramnath
Feed an Opportunity.Starve a Problem
Modified title to be more informative, removed loud bangs, and added code tags... [ April 10, 2004: Message edited by: Barry Gaunt ]
posted 11 years ago
The join(0) with 0 as an argument is the same as join() with no argument. The main thread will wait forever if the started thread does not complete. But the started thread does complete.