0

I am using the MultiThread application.

 ThreadStart thSA = new ThreadStart(saBroker.SearchContract); DTThread threadSA = new DTThread(thSA, WaitForSA); brokerThreads.Add(threadSA); ThreadStart thSA1 = new ThreadStart(saBroker1.SearchContract); DTThread threadSA1 = new DTThread(thSA1, WaitForSA1); brokerThreads.Add(threadSA1); brokerThreads.StartAll(); 

Now i have scenario where i have to perform specific task after the threadSA1 completed. So, how can i track that the specific Thread Complete.

Please Help...

3 Answers 3

2

What is DTThread class? If this is class inherited from Thread, you can wait for it with Join() method:

ThreadStart thSA = new ThreadStart(saBroker.SearchContract); DTThread threadSA = new DTThread(thSA, WaitForSA); brokerThreads.Add(threadSA); ThreadStart thSA1 = new ThreadStart(saBroker1.SearchContract); DTThread threadSA1 = new DTThread(thSA1, WaitForSA1); brokerThreads.Add(threadSA1); brokerThreads.StartAll(); threadSA1.Join(); 
Sign up to request clarification or add additional context in comments.

Comments

1

Now i have scenario where i have to perform specific task after the threadSA1 completed. So, how can i track that the specific Thread Complete.

How about using a delegate callback?

http://msdn.microsoft.com/en-us/library/system.asynccallback(v=VS.100).aspx

Comments

0

You can use a wait and notify tactic to perform synchronization between the threads such that the main thread is halted using a blocking instruction and then just before threadSA1 completes it wakes the blocked thread.

Take a look at this article for more information, which I think will help you: http://www.csharphelp.com/2006/12/thread-and-sync-in-c/

In the article the author uses:

 mre.WaitOne(); 

and

 mre.Set(); 

for waiting and notifying respectively

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.