Somewhere in my main thread I am calling PostThreadMessage(). But I don't know how to handle it in the std::thread I have sent it to.
I am trying to handle it in std::thread like this:
while(true) {
if(GetMessage(&msg, NULL, 0, 0)) {
// Doing appropriate stuff after receiving the message.
}
}
And I am sending the message from the main thread like this:
PostThreadMessage(thread.native_handle(), WM_CUSTOM_MESSAGE, 0, 0);
I don't know if I am supposed to receive the message as I did in my thread.
All I want to know is, how to check whether the "worker thread" is receiving the message I am sending it.