Link to home
Start Free TrialLog in
Avatar of nclgaurav
nclgaurav

asked on

Help for synchronization

hi
I need some help for threading concept.
Suppose we have three thread. And I want to execute all this thread before executing any code.After executing this three thread, I need to execute a block of code.How can I do this.What threading method will be usefull.please give some example and also give some link for threading concept.
Regards
Avatar of Member_2_1001466
Member_2_1001466

What is the reason for three threads if nothing is executed in the main thread before all of them have finished. My logic for using a thread is to keep the main thread reactive/responsive. When you want to block it until all threads have finished I would say one thread can be ommited and its tasks should be executed (as a function?) in the main one.

For general worker threads:
http://www.flounder.com/mvp_tips.htm#Using%20Worker%20Threads

Waiting for threads to finish:
generate an event which is set when the thread is finished. In the main thread you do
WaitForMultipleObject() with all thread events until all of them are set.
ASKER CERTIFIED SOLUTION
Avatar of nonubik
nonubik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial