Thread.Join Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping.
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition |
|---|---|
| ThreadStateException | The caller attempted to join a thread that is in the ThreadState.Unstarted state. |
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
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.