(loc_Ctrl_C_Handler,loc_Exit_Handler) [_WIN32]: Process other
exit methods in the same way as ctrl-c. Change loc_Ctrl_C_Handler() to loc_Exit_Handler() to reflect changed functionality.
This commit is contained in:
parent
1af2a6fc8b
commit
c38a64d3a9
1 changed files with 12 additions and 13 deletions
|
@ -286,25 +286,24 @@ loc_SleepThisThread(unsigned long ulMillisecs)
|
||||||
|
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
* loc_Ctrl_C_Handler
|
* loc_Exit_Handler
|
||||||
*
|
*
|
||||||
* Ctrl-C will initiate a shutdown. This is done by calling
|
* Ctrl-C, Ctrl-Break, Window-Closure, User-Logging-Off or
|
||||||
* empth_request_shutdown()
|
* System-Shutdown will initiate a shutdown.
|
||||||
|
* This is done by calling empth_request_shutdown()
|
||||||
*/
|
*/
|
||||||
static BOOL
|
static BOOL
|
||||||
loc_Ctrl_C_Handler(DWORD fdwCtrlType)
|
loc_Exit_Handler(DWORD fdwCtrlType)
|
||||||
{
|
{
|
||||||
switch (fdwCtrlType)
|
switch (fdwCtrlType)
|
||||||
{
|
{
|
||||||
// Handle the CTRL+C signal.
|
|
||||||
case CTRL_C_EVENT:
|
case CTRL_C_EVENT:
|
||||||
empth_request_shutdown();
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case CTRL_CLOSE_EVENT:
|
case CTRL_CLOSE_EVENT:
|
||||||
case CTRL_BREAK_EVENT:
|
case CTRL_BREAK_EVENT:
|
||||||
case CTRL_LOGOFF_EVENT:
|
case CTRL_LOGOFF_EVENT:
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
case CTRL_SHUTDOWN_EVENT:
|
||||||
|
empth_request_shutdown();
|
||||||
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -419,7 +418,7 @@ empth_init(char **ctx_ptr, int flags)
|
||||||
logerror("Failed to create shutdown event %d", GetLastError());
|
logerror("Failed to create shutdown event %d", GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)loc_Ctrl_C_Handler, TRUE);
|
SetConsoleCtrlHandler((PHANDLER_ROUTINE)loc_Exit_Handler, TRUE);
|
||||||
|
|
||||||
/* Create the global Thread context. */
|
/* Create the global Thread context. */
|
||||||
pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
|
pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue