vm: don't SIGQUIT on unix or Ctrl-Break on windows
This gives us an escape hatch for when things go way south and ^C can't be handled. Also unmask SIGQUIT and SIGTERM from the stdin_loop thread so the thread doesn't keep the process alive after those signals.db4
parent
e29c4589c4
commit
9e4a51c55f
|
@ -337,7 +337,6 @@ void factor_vm::unix_init_signals()
|
|||
#endif
|
||||
|
||||
init_sigaction_with_handler(&fep_sigaction, fep_signal_handler);
|
||||
sigaction_safe(SIGQUIT,&fep_sigaction,NULL);
|
||||
sigaction_safe(SIGINT,&fep_sigaction,NULL);
|
||||
|
||||
init_sigaction_with_handler(&sample_sigaction, sample_signal_handler);
|
||||
|
@ -431,6 +430,8 @@ void *stdin_loop(void *arg)
|
|||
sigfillset(&mask);
|
||||
sigdelset(&mask, SIGUSR2);
|
||||
sigdelset(&mask, SIGTTIN);
|
||||
sigdelset(&mask, SIGTERM);
|
||||
sigdelset(&mask, SIGQUIT);
|
||||
pthread_sigmask(SIG_SETMASK, &mask, NULL);
|
||||
|
||||
while(loop_running)
|
||||
|
|
|
@ -280,17 +280,16 @@ static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
|
|||
{
|
||||
switch (dwCtrlType) {
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_BREAK_EVENT:
|
||||
{
|
||||
/* The CtrlHandler runs in its own thread without stopping the main thread.
|
||||
Since in practice nobody uses the multi-VM stuff yet, we just grab the first
|
||||
VM we can get. This will not be a good idea when we actually support native
|
||||
threads. */
|
||||
assert(thread_vms.size() == 1);
|
||||
factor_vm *vm = thread_vms.begin()->second;
|
||||
vm->safepoint.enqueue_fep(vm);
|
||||
return TRUE;
|
||||
}
|
||||
{
|
||||
/* The CtrlHandler runs in its own thread without stopping the main thread.
|
||||
Since in practice nobody uses the multi-VM stuff yet, we just grab the first
|
||||
VM we can get. This will not be a good idea when we actually support native
|
||||
threads. */
|
||||
assert(thread_vms.size() == 1);
|
||||
factor_vm *vm = thread_vms.begin()->second;
|
||||
vm->safepoint.enqueue_fep(vm);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue