Thread.Join Method (Int32)
Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Parameters
- millisecondsTimeout
- Type: System.Int32
The number of milliseconds to wait for the thread to terminate.
Return Value
Type: System.Booleantrue if the thread has terminated; false if the thread has not terminated after the amount of time specified by the millisecondsTimeout parameter has elapsed.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The value of millisecondsTimeout is negative and is not equal to Timeout.Infinite in milliseconds. |
| ThreadStateException | The thread has not been started. |
If Timeout.Infinite is specified for the millisecondsTimeout parameter, this method behaves identically to the Join() method overload, except for the return value.
If the thread has already terminated when Join is called, the method returns immediately.
This method changes the state of the calling thread to include ThreadState.WaitSleepJoin. You cannot invoke Join on a thread that is in the ThreadState.Unstarted state.
Version Notes
Silverlight for Windows Phone
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.