This documentation is archived and is not being maintained.

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
public bool Join(
 int millisecondsTimeout
public: bool Join(
 int millisecondsTimeout
public function Join(
   millisecondsTimeout : int
) : Boolean;


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.


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.


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.


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