Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WaitForMultipleObjects

WaitForMultipleObjects

Scheduled Pinned Locked Moved C / C++ / MFC
debugging
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shaileshhex
    wrote on last edited by
    #1

    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

    R M 2 Replies Last reply
    0
    • S Shaileshhex

      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

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      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 that WaitForMultipleObjects() 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

      1 Reply Last reply
      0
      • S Shaileshhex

        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

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        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")

        S 1 Reply Last reply
        0
        • M Mark Salsbery

          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")

          S Offline
          S Offline
          Shaileshhex
          wrote on last edited by
          #4

          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

          M 1 Reply Last reply
          0
          • S Shaileshhex

            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

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            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")

            S 1 Reply Last reply
            0
            • M Mark Salsbery

              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")

              S Offline
              S Offline
              Shaileshhex
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • S Shaileshhex

                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

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                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")

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups