If this is a Windows Win32 application, then using the application message queue is a common approach. In the main window of your application, you are waiting for a custom user message, usually it will be something like:
(in header file)
[EDIT] In the Console application, try using Windows Events. Therefore, create a named event using:
(On primary thread) HANDLE myEvent = CreateEvent(NULL, FALSE, FALSE, "MyEvent"); ... later as part of a message processing loop while(true) { WaitForSingleObject( myEvent, 0 ); // Block until event is triggers in secondary thread ... process messages here ... I recommend storing "messages" in a synchronized queue } (On secondary thread) SetEvent(myEvent); // Triggers the event on the main thread.
source share