Norm:
I was suprised the join didn't throw an exception. How can a thread continue executing after it ends???
The thread is not executing after it has ended. The main thread has not at all finished execution.
In the provided code, the main thread is trying to join with itself.
Join mandates that the thread on which the join is called must complete before the thread from which the join is called can resume.
Since, the thread calling join and on which the join is called are same, the join will never return.
I am not sure whether this scenario categorized into a "deadlock" but definetly the program never completes.
[ July 28, 2008: Message edited by: Nitesh Kant ]