Click here to Skip to main content
16,005,080 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
_Magnus_22-Apr-02 0:33
_Magnus_22-Apr-02 0:33 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
kortebi22-Apr-02 1:12
kortebi22-Apr-02 1:12 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
_Magnus_22-Apr-02 5:50
_Magnus_22-Apr-02 5:50 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
Neville Franks22-Apr-02 1:43
Neville Franks22-Apr-02 1:43 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
kortebi22-Apr-02 3:18
kortebi22-Apr-02 3:18 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
Joaquín M López Muñoz22-Apr-02 3:29
Joaquín M López Muñoz22-Apr-02 3:29 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
Neville Franks22-Apr-02 10:59
Neville Franks22-Apr-02 10:59 
GeneralRe: WaitForMultipleObject() and Threads Synch Pin
23-Apr-02 0:50
suss23-Apr-02 0:50 
Within your for loop you increment the m_nThreadsNbr with two every time
you start two threads. This should work for the first iteration but during your second iteration the value of m_nThreadsNbr is the number of threads started during BOTH iterations but the handle array only contains the thread handles from the last iteration.

Replace the
DWORD dw = WaitForMultipleObjects(m_nThreadsNbr, hThreads, TRUE, 5000);
with
DWORD dw = WaitForMultipleObjects(handl, hThreads, TRUE, 5000);
or reset the m_nThreadsNbr to zero in the begining of the for iteration.


In your switch you test the return value from WaitForMultipleObjects against
WAIT_OBJECT_0 + 0, WAIT_OBJECT_0 + 1 and WAIT_OBJECT_0 + 2 in order to see which thread that has terminated BUT when you call the WaitForMultipleObjects you set the bWaitForAll parameter to TRUE which will result in that when WaitForMultipleObjects returns WAIT_OBJECT_0 this means that all threads are terminated. WAIT_OBJECT_0 + 1 and WAIT_OBJECT_0 + 2 will never be returned from WaitForMultipleObjects as long as bWaitForAll is TRUE.


QuestionWhat MsOffice file type is ? Pin
22-Apr-02 0:12
suss22-Apr-02 0:12 
AnswerRe: What MsOffice file type is ? Pin
Christian Graus22-Apr-02 0:35
protectorChristian Graus22-Apr-02 0:35 
AnswerRe: What MsOffice file type is ? Pin
bryce22-Apr-02 1:47
bryce22-Apr-02 1:47 
GeneralMs Word automation... Generating Tables Damn Slow ! Pin
Braulio Dez22-Apr-02 0:04
Braulio Dez22-Apr-02 0:04 
GeneralRe: Ms Word automation... Generating Tables Damn Slow ! Pin
Bill Wilson22-Apr-02 9:17
Bill Wilson22-Apr-02 9:17 
GeneralRe: Ms Word automation... Generating Tables Damn Slow ! Pin
Braulio Dez22-Apr-02 21:02
Braulio Dez22-Apr-02 21:02 
GeneralDateTimePicker Size Pin
22-Apr-02 0:01
suss22-Apr-02 0:01 
GeneralChange Application Fonts, Time Picker Pin
21-Apr-02 22:17
suss21-Apr-02 22:17 
Questionhow can i add preview function like ie. thx Pin
21-Apr-02 22:07
suss21-Apr-02 22:07 
GeneralWriteProfileString Pin
Gaurika Wijeratne21-Apr-02 21:17
Gaurika Wijeratne21-Apr-02 21:17 
GeneralRe: WriteProfileString Pin
Mazdak21-Apr-02 21:34
Mazdak21-Apr-02 21:34 
GeneralRe: WriteProfileString Pin
Mazdak21-Apr-02 21:48
Mazdak21-Apr-02 21:48 
QuestionManaged C++ - A must in Visual C++ .NET? Pin
Rickard Andersson2021-Apr-02 20:30
Rickard Andersson2021-Apr-02 20:30 
AnswerRe: Managed C++ - A must in Visual C++ .NET? Pin
Christian Graus21-Apr-02 20:41
protectorChristian Graus21-Apr-02 20:41 
AnswerRe: Managed C++ - A must in Visual C++ .NET? Pin
Chris Maunder21-Apr-02 20:42
cofounderChris Maunder21-Apr-02 20:42 
GeneralRe: Managed C++ - A must in Visual C++ .NET? Pin
Rickard Andersson2021-Apr-02 22:29
Rickard Andersson2021-Apr-02 22:29 
GeneralRe: Managed C++ - A must in Visual C++ .NET? Pin
Christian Graus21-Apr-02 22:44
protectorChristian Graus21-Apr-02 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.