g]Thread.join will return immediately if the timeout value is zero h] A timeout of zero will allow Thread.join to wait forever if necessary .
According to my understanding g] should be true and h] should be false.But the answer is other way round. The maximum time limit to wait for the death of the referenced thread can be specified in milliseconds by an argument. Now if time-out is 0 secs then shouldnt g be correct. Maybe there is something wrong in my understanding..Plz help me clarify this concept.
Anjali [ October 04, 2005: Message edited by: Barry Gaunt ]
Have you read the API for the Thread join method? If you have not, then I suggest that you do so. If you need help on finding the API or the appropriate part of it please let us know, and we will direct you to it.
I have gone through it Barry...But will take your suggestion and read it again.Maybe I missed something or mis-interpreted something. Thanks, Anjali [ October 05, 2005: Message edited by: anjali desh ]
join public final void join(long millis) throws InterruptedException Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever.
Joined: Aug 04, 2005
Will time-out of 0 be represented as.. t2.join(0)? Wont this mean wait atmost 0 seconds? So wont thread t1 return to the runnable state immediately?
Joined: Aug 03, 2002
No, because: A timeout of 0 means to wait forever. join(0) will wait forever, by definition it is an exception to the rule.
Object.wait also waits forever if the argument is 0.
(Sorry Anjali about the emphasis on reading the API. I did it because some posters never do take look at it when they have a doubt.)
Joined: Aug 04, 2005
Thanks a lot Barry..This question was troubling me since morning and I was finding it hard to concentrate on other topics..especially as I have got my exam scheduled on saturday and threads is one of the most dreaded topics!! And you definately dont have to say sorry!!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com