Click here to Skip to main content
13,594,513 members
Rate this:
Please Sign up or sign in to 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.

Posted 22-Jan-13 1: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 | Cookies | Terms of Service
Web02 | 2.8.180621.3 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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