1 From 7c0ac64ebea38d0d9ff4d160db4d33bc087a3490 Mon Sep 17 00:00:00 2001
2 From: Robert McMahon <rjmcmahon@rjmcmahon.com>
3 Date: Mon, 16 Jul 2018 17:51:29 -0700
4 Subject: [PATCH] fix latent bug in signal handling, per POSIX calling exit()
5 in signal handler is not safe. Use _exit() instead. Also, detect the user
6 signal SIGINT for the case of server needing two invocations to stop server
7 threads. Note: the server threads still need some work from graceful
8 termination with a single ctrl-c
14 @@ -171,7 +171,7 @@ void sig_exit( int inSigno ) {
25 @@ -268,7 +268,7 @@ void Sig_Interupt( int inSigno ) {
26 // We try to not allow a single interrupt handled by multiple threads
27 // to completely kill the app so we save off the first thread ID
28 // then that is the only thread that can supply the next interrupt
29 - if ( thread_equalid( sThread, thread_zeroid() ) ) {
30 + if ( (inSigno == SIGINT) && thread_equalid( sThread, thread_zeroid() ) ) {
31 sThread = thread_getid();
32 } else if ( thread_equalid( sThread, thread_getid() ) ) {
34 @@ -420,9 +420,3 @@ VOID ServiceStop() {