Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Win7 VC++
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 22-Jan-13 1:31am
Comments
Sergey Alexandrovich Kryukov at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 370
1 Gihan Liyanage 338
2 ChauhanAjay 180
3 Vinay Mistry 160
4 Sergey Alexandrovich Kryukov 130
0 Sergey Alexandrovich Kryukov 9,011
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100