views:

52

answers:

4

Hi,

May be it sound dumb but if I want some computed value from other 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

+1  A: 

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

Andrew Bezzub
Thanks Andrew...ya it was ThreadState
BreakHead
+1  A: 

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.

Thomas
Thanks Thomas!!! will you please elaborate this....Thansks
BreakHead
A: 

This I was searching Thread.ThreadState,checks the state of the thread by examining the ThreadState property of the thread.

BreakHead
Next time use comments to the answer you want to reply..
Gaby
A: 

Thread.ThreadState or Thread.Join if you want to wait for your threads. Or use Semaphore

Andrey