Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I want to perform the following things:

1) Run 2 threads in background.
2)One thread must take user input and pass it to another thread.
3)When the work of thread 1 is complete then raise.

I did the steps 1 and 2 but unsuccessfully, because the console does not print out any thing.
How to achieve step 3.


Thanks
Posted
Comments
Taha Akhtar 21-Dec-13 5:55am    
Set a Shared variable and wait for that variable in 2nd Thread
Sampath Lokuge 21-Dec-13 7:16am    
Can you put your code snippet ?
Sergey Alexandrovich Kryukov 21-Dec-13 22:32pm    
The question makes no sense, "then raise" part. Raise what, what would it supposed to mean. And I would not advise to write a console application with interactive input, especially with threads, it would be quite impractical. Input of nearly all more or less professional console-only application is based on command line.
—SA
Rahul VB 22-Dec-13 0:38am    
Hello Sir,
I am sorry for an incomplete question. What i meant was to raise an event as soon as the thread completes its work.
Thanks

1 solution

Thank you for clarification. Create some event in some type and invoke it in the thread before it is complete. If don't know how to create and invoke event instances, first read about it in MSDN documentation. Just do it, and, if you get stuck again, show this code and ask your follow-up questions by adding a comment to this answer.

—SA
 
Share this answer
 
Comments
Rahul VB 5-Feb-14 13:53pm    
Hello Sir,
How are you? I just tried it out once again. i switched back to that project. Worked out well. Sorry for the late reply.

Thanks a ton,
Rahul
Sergey Alexandrovich Kryukov 5-Feb-14 14:09pm    
Great.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900