|Microsoft DirectX 9.0|
The WaitMsg method waits for the event to be signaled, while dispatching sent messages.
BOOL WaitMsg( DWORD dwTimeOut = INFINITE );
Optional time-out value, in milliseconds.
Returns TRUE if the event is signaled, or FALSE if the time-out occurred.
This method calls the PeekMessage function to process messages. Call this method instead of CAMEvent::Wait if your thread needs to process messages while waiting for an event. If the thread does not process messages and another thread sends a message, deadlock could occur.
For example, suppose you create a thread and then block until the thread initializes. If the thread sends a message to your window by calling the SendMessage function, it will result in a deadlock. This is because SendMessage does not return until the message has been processed. Calling WaitMsg allows the SendMessage call to return, preventing the deadlock.