Share via


Implementing ContinueFromSynchronousEvent

When a synchronous event is sent to the session debug manager (SDM) for processing, the debug engine waits for a response from the SDM indicating that the event has been handled. The SDM indicates it is done with the synchronous event by calling IDebugEngine2::ContinueFromSynchronousEvent. Since CEventBase::SendEvent has suspended the thread it is in by calling GetMessage in a message pump, IDebugEngine2::ContinueFromSynchronousEvent posts a message to the current thread. When SendEvent receives this message, it breaks out of the message pump and returns to its caller.

To implement ContinueFromSynchronousEvent

  1. Open the stdafx.h file and insert the following line at the end of the file:

    using namespace ATL;
    
    #define WM_CONTINUE_SYNC_EVENT WM_USER + 0x99 
    
  2. Open the EventBase.cpp file, find CEventBase::SendEvent, and replace the line //TODO: ADD CONTINUE EVENT TEST with the following:

                if (msg.message == WM_CONTINUE_SYNC_EVENT) 
                    break; 
    
  3. Open the Engine.cpp file, find CEngine::ContinueFromSynchronousEvent, and replace the line //TODO: IMPLEMENT CONTINUE as well as the following return statement with the following:

        PostThreadMessage(GetCurrentThreadId(), WM_CONTINUE_SYNC_EVENT, 0, 0); 
        return S_OK; 
    
  4. Build the project to make sure there are no errors.

See Also

Concepts

Sending the Startup Events