Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi There,

I have created for 10 threads using AfxbeginThread API.

but i wants to start all 10 threads at a time, i don't wants to start the thread one by one.

Can any one can help how to implement.


Regards,
Ranjith
Posted
Comments
Sergey Alexandrovich Kryukov 22-Jan-13 11:18am    
This is not a question, and you statement simply makes no sense. If you think about it, you will see that there is no difference.
—SA

1 solution

It is very easy to do. In the main program body (main thread) create an Event Object[^] with the initial state nonsignaled. Pass the event handle to all your threads. Then in all the thread routines specify WaitForSingleObject() to wait for the event to become signaled. Once you have created all the threads, put the event to signaled state using SetEvent(). All your threads will continue execution.
 
Share this answer
 

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