Blocks the calling thread until the thread on which this method is invoked terminates or the specified time elapses.
- timeout
- A TimeSpan set to the amount of time to wait for the thread to terminate. Specify Timeout.Infinite milliseconds to wait indefinitely.
true if the thread has terminated; false if the thread has not terminated after the amount of time specified by timeout has elapsed.
Type Reason ArgumentOutOfRangeException The value of timeout is negative and is not equal to Timeout.Infinite milliseconds, or is greater than int.MaxValue milliseconds. System.Threading.ThreadStateException The caller attempted to join a thread that is in the ThreadState.Unstarted state.
This method converts timeout to milliseconds, tests the validity of the converted value, and calls Thread.Join(int).
Note: If Timeout.Infinite milliseconds is specified for timeout, this method behaves identically to Join (), except for the return value.Join cannot be invoked on a thread that is in the ThreadState.Unstarted state.
This method changes the state of the current thread to include ThreadState.WaitSleepJoin.
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0