PeekMessage?

  • Thread starter Thread starter a_unique_name
  • Start date Start date
A

a_unique_name

Guest
Hi Folks:

Developing on Windows 10 Pro, VS 2017 Community, all C++, Win32 no MFC.

I might be approaching this all wrong. Suggestions are appreciated.

I have a multi threading app that checks for a mutex block with WaitForSingleObject().

If the first thread is blocked because of the mutex I'd like the first thread to post a message, let's call it "X", to a dialog window the first thread owns.

While this is happening the second thread will work on whatever's blocking the first thread. This task should take a small fraction of a second.

While the second thread is finishing it's task I'd like the first thread to pull message "X" off of the queue before processing any other messages, even those that might have been on the queue before it.

If the second thread is still blocking, I want the first thread that's servicing message "X" to post message "X" again.

And, again, I'll want the first thread to pull message X off of the queue ahead of any other messages. If the second thread has unblocked, message "X" will be serviced, the first thread will alter a resource it shares with the second thread and go back to the business of servicing all of the messages in it's queue.

While typing this explanation of my problem a possible solution has occurred to me, but I'd like to see what others think the WinMain() GetMessage() and PeekMessage() code should look like.

Thanks
Larry

Continue reading...
 
Back
Top