-
Events
hi,
i am using events in my code,
i set event at function a
and wait for it at function b
but as i see function b receives the same (LAST) event 4 times
anybody have an idea?
Code:
HANDLE exvereport[2];
exvereport[0] = reportevent;
exvereport[1] = hExitEvent;
DWORD durum;
while(true)
{
durum = WaitForMultipleObjects(2,exvereport,FALSE,INFINITE);
switch(durum)
{
case WAIT_OBJECT_0+1:
return (0);//end thread
case WAIT_OBJECT_0:
message = useroutput;
break;
}
Sleep(10); //do not use processor %100
}
}
-
Re: Events
Have you reset the events before calling the function?
-
Re: Events
i had set it auto reset
while creating event
-
Re: Events
Add a default: statement to your switch block and use GetLastError() to retrieve the error that appears if there are any issues with the handles or WaitForMultipleObjects call.