WaitForMultipleObjects
-
I have a call to WaitForMultipleObjects() which waits for any of 4 events to happen ...but the statements after the call to WaitForMultipleObjects() are not executed. i am not able to debug and get wat value is returned by the call WaitForMultipleObjects() thanks in advance
-
I have a call to WaitForMultipleObjects() which waits for any of 4 events to happen ...but the statements after the call to WaitForMultipleObjects() are not executed. i am not able to debug and get wat value is returned by the call WaitForMultipleObjects() thanks in advance
What does your code look like? Post the call to
WaitForMultipleObjects()
and its surroundings and please use <pre> / </pre> tags when posting code. Are you absolutely sure thatWaitForMultipleObjects()
is called? Place a breakpoint on it to verify this.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
I have a call to WaitForMultipleObjects() which waits for any of 4 events to happen ...but the statements after the call to WaitForMultipleObjects() are not executed. i am not able to debug and get wat value is returned by the call WaitForMultipleObjects() thanks in advance
Shaileshhex wrote:
but the statements after the call to WaitForMultipleObjects() are not executed.
Even if you use a timeout value? If you never get past a wait function then none of the objects were signalled. Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
-
Shaileshhex wrote:
but the statements after the call to WaitForMultipleObjects() are not executed.
Even if you use a timeout value? If you never get past a wait function then none of the objects were signalled. Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
hi... Thanks for ur replies... i think ur right may b the event is not signalled.... code is as below aslso its not my code and, event created is ITC_APP_EVENT_RIGHTSCAN...i have no idea where ITC_APP_EVENT_RIGHTSCAN comes from..... hCenterDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_CENTERSCAN")); hCenterState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_CENTERSCAN")); hRightDelta=CreateEvent(NULL, FALSE, FALSE,_T("ITC_APP_EVENT_RIGHTSCAN")); hRightState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_RIGHTSCAN")); hLeftDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_LEFTSCAN")); hLeftState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_LEFTSCAN")); hIRDAReset=CreateEvent(NULL, TRUE, FALSE, _T("NOTIFICATION_EVENT_WAKEUP")); h = CreateEvent( NULL, TRUE, FALSE, EVENTNAME_KEYBOARD_CHANGE ); if ( h != INVALID_HANDLE_VALUE ) { SetEvent( h ); CloseHandle( h ); } // end if //the closed event hClosed = CreateEvent(NULL,TRUE,FALSE,_T("RfidCloseEvent")); HANDLE hObjectList[] = { hClosed, hCenterDelta, hRightDelta, hLeftDelta, hIRDAReset }; while (1) { DWORD wc = WaitForMultipleObjects( sizeof(hObjectList)/sizeof(HANDLE), // number of handles in array hObjectList, // object-handle array FALSE, // wait option (DWORD) INFINITE // time-out interval ); //THE breakpoint holds at this point... switch ( wc) { WAIT_OBJECT_0 + 2: //Center button if (WaitForSingleObject(hRightState,0)==WAIT_OBJECT_0) { //some code } etc..etc.. } } LET ME KNOW UR THOUGHTS bye
-
hi... Thanks for ur replies... i think ur right may b the event is not signalled.... code is as below aslso its not my code and, event created is ITC_APP_EVENT_RIGHTSCAN...i have no idea where ITC_APP_EVENT_RIGHTSCAN comes from..... hCenterDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_CENTERSCAN")); hCenterState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_CENTERSCAN")); hRightDelta=CreateEvent(NULL, FALSE, FALSE,_T("ITC_APP_EVENT_RIGHTSCAN")); hRightState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_RIGHTSCAN")); hLeftDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_LEFTSCAN")); hLeftState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_LEFTSCAN")); hIRDAReset=CreateEvent(NULL, TRUE, FALSE, _T("NOTIFICATION_EVENT_WAKEUP")); h = CreateEvent( NULL, TRUE, FALSE, EVENTNAME_KEYBOARD_CHANGE ); if ( h != INVALID_HANDLE_VALUE ) { SetEvent( h ); CloseHandle( h ); } // end if //the closed event hClosed = CreateEvent(NULL,TRUE,FALSE,_T("RfidCloseEvent")); HANDLE hObjectList[] = { hClosed, hCenterDelta, hRightDelta, hLeftDelta, hIRDAReset }; while (1) { DWORD wc = WaitForMultipleObjects( sizeof(hObjectList)/sizeof(HANDLE), // number of handles in array hObjectList, // object-handle array FALSE, // wait option (DWORD) INFINITE // time-out interval ); //THE breakpoint holds at this point... switch ( wc) { WAIT_OBJECT_0 + 2: //Center button if (WaitForSingleObject(hRightState,0)==WAIT_OBJECT_0) { //some code } etc..etc.. } } LET ME KNOW UR THOUGHTS bye
The only thing I see in your code sample is WAIT_OBJECT_0 + 2: //Center button WAIT_OBJECT_0 + 2 corresponds to the hRightDelta event handle, not the hCenterDelta event handle. Remember the array is indexed from 0 :) If you put a breakpoint on the switch ( wc) line and execution never pauses there then none of the five events eing waited on are getting signalled. Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
-
The only thing I see in your code sample is WAIT_OBJECT_0 + 2: //Center button WAIT_OBJECT_0 + 2 corresponds to the hRightDelta event handle, not the hCenterDelta event handle. Remember the array is indexed from 0 :) If you put a breakpoint on the switch ( wc) line and execution never pauses there then none of the five events eing waited on are getting signalled. Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
hi Mark... I found that the events ITC_APP_EVENT_RIGHTSCAN etc ..were not present in the devices registry...so i added these events ..but still that event does not get signalled .... my device uses WIN CE 3.0...but the event gets signalled for another device which has WINCE 4.2 does this mean that 3.0 does not recognise ITC_APP_EVENT_RIGHTSCAN??...if so then how do i find which is the correct event thanks
-
hi Mark... I found that the events ITC_APP_EVENT_RIGHTSCAN etc ..were not present in the devices registry...so i added these events ..but still that event does not get signalled .... my device uses WIN CE 3.0...but the event gets signalled for another device which has WINCE 4.2 does this mean that 3.0 does not recognise ITC_APP_EVENT_RIGHTSCAN??...if so then how do i find which is the correct event thanks
Hmm I have no idea how event objects relate to the registry. You are creating named event objects in your code. That means if an event with the same name already exists on the system then you'll get a handle to that same event. If the event does not already exist in the system, you get a new event object. Are you sure these "ITC_APP_EVENT_xxx" strings represent the name of named events in another process? This has nothing to do with the registry. Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")