Click here to Skip to main content
11,927,711 members (29,932 online)
Rate this:
Please Sign up or sign in to vote.
See more: Windows Win7 VisualC++
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.

Posted 22-Jan-13 2:31am
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.

1 solution

Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2015
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