Hiya
I have an application which creates a worker thread to
handle incoming network data. The thread is created
using the Win32 function CreateThread(). When the worker
thread a received a piece of data, it sends a message to
the main application so it can be processed:
void Blah::Callback() {
theApp.m_pMainWnd->PostMessage(ID_DATA_READY);
}
The main window had a handler for this message which
retrieves and processes the data.
While this has been working fine in my tests, I haven't
been able to confirm that this method is guaranteed to
be thread safe, ie. avoids the situation where the
message is being posted just as the main window starts to
look at its queue.
Anyone know if this technique is safe?
Cheers,