mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 13:20:28 -05:00
Don't forward Windows events to the child. It already receives them.
This commit is contained in:
parent
6daaafc17b
commit
1552f892d3
1 changed files with 13 additions and 5 deletions
|
|
@ -121,15 +121,23 @@ static BOOL WINAPI console_handler(DWORD ctrl_type)
|
||||||
switch (ctrl_type) {
|
switch (ctrl_type) {
|
||||||
case CTRL_C_EVENT :
|
case CTRL_C_EVENT :
|
||||||
case CTRL_BREAK_EVENT :
|
case CTRL_BREAK_EVENT :
|
||||||
/* forward the event to child process */
|
/*
|
||||||
GenerateConsoleCtrlEvent(ctrl_type, GetProcessId(child_process));
|
* Return TRUE to prevent parent termination. The child process
|
||||||
|
* will receive these events automatically because it's attached
|
||||||
|
* to the same console, so we don't need to forward them.
|
||||||
|
*/
|
||||||
return TRUE; /* signal handled, don't terminate parent */
|
return TRUE; /* signal handled, don't terminate parent */
|
||||||
case CTRL_CLOSE_EVENT :
|
case CTRL_CLOSE_EVENT :
|
||||||
case CTRL_LOGOFF_EVENT :
|
case CTRL_LOGOFF_EVENT :
|
||||||
case CTRL_SHUTDOWN_EVENT :
|
case CTRL_SHUTDOWN_EVENT :
|
||||||
/* these can't be easily forwarded, but we can terminate child */
|
/*
|
||||||
TerminateProcess(child_process, 1);
|
* Return TRUE to prevent our termination while child handles shutdown.
|
||||||
return TRUE; /* signal handled, proceed with termination */
|
* The child receives these events automatically (same console).
|
||||||
|
* Note: Windows will forcibly kill us after a timeout regardless
|
||||||
|
* of returning TRUE: ~5 seconds for CLOSE_EVENT and LOGOFF_EVENT,
|
||||||
|
* ~5-20 seconds for SHUTDOWN_EVENT (configurable in registry).
|
||||||
|
*/
|
||||||
|
return TRUE; /* signal handled, but Windows will kill us after timeout */
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue