Thread.Join Method
.NET Framework 4
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 | |
|---|---|---|
|
Join | Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping. |
|
Join(Int32) | Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping. |
|
Join(TimeSpan) | Blocks the calling thread until a thread terminates or the specified time elapses, while continuing to perform standard COM and SendMessage pumping. |
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:
http://social.msdn.microsoft.com/Forums/en/csharplanguage/thread/e32a2fea-752f-4936-96da-0dc6945f463d
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
- 1/20/2011
- Winston Muller
