4 out of 38 rated this helpful Rate this topic

Thread.Join Method

Blocks the calling thread until a thread terminates.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Join Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping.
Public method Join(Int32) Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.
Public method Join(TimeSpan) Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping.
Top
Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ
Notes
Note that the Thread.Join() method only blocks the calling thread (usually the application's main thread of execution) until your thread object completes. You can still have other threads executing in the background while waiting for your specific Thread to finish executing.

If you have started a thread, you can use the following code to find a thread, presuming you have stored the ThreadID:

int threadId = 0xFF;

Process currentProcess = Process.GetCurrentProcess();

foreach( Thread thread in currentProcess.Threads )
{
    if( thread.ManagedThreadId.Equals( threadId ) )
    {
        thread.Join();
    }
}

http://social.msdn.microsoft.com/Forums/en/csharplanguage/thread/e32a2fea-752f-4936-96da-0dc6945f463d