// This handler is called by Windows in a different thread when a console event happens
// FIXME: When the console window is closed, the application is supposedly terminated as soon as
// this handler returns. We may want to block and wait for the main thread so set some
// condition variable once shutdown is complete...
static BOOL WINAPI consoleCtrlHandler(DWORD ctrlType)
{
// This handler is called by Windows in a different thread when a console event happens
// FIXME: When the console window is closed, the application is supposedly terminated as soon as
// this handler returns. We may want to block and wait for the main thread so set some
// condition variable once shutdown is complete...
static BOOL WINAPI consoleCtrlHandler(DWORD ctrlType)
{
- switch (ctrlType) {
- case CTRL_C_EVENT: // Ctrl+C
- case CTRL_CLOSE_EVENT: // Closing the console window
- WindowsSignalWatcher::signalHandler(SIGTERM);
- return TRUE;
- default:
- return FALSE;
- }
+ switch (ctrlType) {
+ case CTRL_C_EVENT: // Ctrl+C
+ case CTRL_CLOSE_EVENT: // Closing the console window
+ WindowsSignalWatcher::signalHandler(SIGTERM);
+ return TRUE;
+ default:
+ return FALSE;
+ }
: AbstractSignalWatcher{parent}
, Singleton<WindowsSignalWatcher>{this}
{
: AbstractSignalWatcher{parent}
, Singleton<WindowsSignalWatcher>{this}
{