Share via


Thread.Join Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Sub Join
[SecuritySafeCriticalAttribute]
public void Join()

Exceptions

Exception Condition
ThreadStateException

The caller attempted to join a thread that is in the ThreadState.Unstarted state.

Remarks

Use this method to ensure that a thread has terminated. The caller will block indefinitely if the thread does not terminate. 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 Silverlight for Windows Phone

When a user navigates away from a Windows Phone application, the application is typically put into a dormant state. When the user returns to a dormant application, the application automatically resumes. If the application is put into a dormant state while this API is being used, the API will not complete as expected. Applications should be designed to handle this possibility. For more information about the Windows Phone execution model, see Execution Model for Windows Phone.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.