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.
#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);
sigfillset(&mask);
sigdelset(&mask, SIGUSR2);
sigdelset(&mask, SIGTTIN);
+ sigdelset(&mask, SIGTERM);
+ sigdelset(&mask, SIGQUIT);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
while(loop_running)
{
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;
}