How to get thread status..in Multi threading
May be it sound dumb but if I want some computed value from other开发者_Python百科 thread and other value from one more thread and this two value in my main thread how can I,if In case second thread completed before first one.it will create problem..so I just want is there any way that I can get the thread status means its still running or stop.
Thanks
Sounds like you want to wait until both threads have finished. Simply call Join on each of them. After the calls have returned, you know that both threads have finished.
Thread
class have ThreadState
property, but make sure you know about thread synchronization. Here are two articles:
http://msdn.microsoft.com/en-us/library/dsw9f9ts%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/magazine/cc188793.aspx
Thread.ThreadState
or Thread.Join
if you want to wait for your threads. Or use Semaphore
精彩评论