Export (0) Print
Expand All

Thread.Join Method (Int32)

.NET Framework 1.1

Blocks the calling thread until a thread terminates or the specified time elapses.

[Visual Basic]
Overloads Public Function Join( _
   ByVal millisecondsTimeout As Integer _
) As Boolean
[C#]
public bool Join(
 int millisecondsTimeout
);
[C++]
public: bool Join(
 int millisecondsTimeout
);
[JScript]
public function Join(
   millisecondsTimeout : int
) : Boolean;

Parameters

millisecondsTimeout
The number of milliseconds to wait for the thread to terminate.

Return Value

true if the thread has terminated; false if the thread has not terminated after the amount of time specified by the millisecondsTimeout parameter has elapsed.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The value of millisecondsTimeout is negative and is not equal to Timeout.Infinite in milliseconds.
ThreadStateException The thread has not been started.

Remarks

If Timeout.Infinite is specified for the millisecondsTimeout parameter, this method behaves identically to Join(), except for the return value.

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.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

Thread Class | Thread Members | System.Threading Namespace | Thread.Join Overload List | Thread States

Show:
© 2015 Microsoft