|
|
@ -67,7 +67,7 @@ int drop_signals(void* nc){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_mutex_unlock(&lock);
|
|
|
|
pthread_mutex_unlock(&lock);
|
|
|
|
if(ret){
|
|
|
|
if(ret){
|
|
|
|
fprintf(stderr, "Couldn't drop signals with %p (had %p)\n", nc, expected);
|
|
|
|
fprintf(stderr, "Signals weren't registered for %p (had %p)\n", nc, expected);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -105,11 +105,14 @@ int setup_signals(void* vnc, bool no_quit_sigs, bool no_winch_sig,
|
|
|
|
notcurses* nc = vnc;
|
|
|
|
notcurses* nc = vnc;
|
|
|
|
void* expected = NULL;
|
|
|
|
void* expected = NULL;
|
|
|
|
struct sigaction sa;
|
|
|
|
struct sigaction sa;
|
|
|
|
|
|
|
|
// don't register ourselves if we don't intend to set up signal handlers
|
|
|
|
|
|
|
|
if(!no_winch_sig || !no_quit_sigs){
|
|
|
|
// we expect NULL (nothing registered), and want to register nc
|
|
|
|
// we expect NULL (nothing registered), and want to register nc
|
|
|
|
if(!atomic_compare_exchange_strong(&signal_nc, &expected, nc)){
|
|
|
|
if(!atomic_compare_exchange_strong(&signal_nc, &expected, nc)){
|
|
|
|
loginfo(nc, "%p is already registered for signals (provided %p)\n", expected, nc);
|
|
|
|
loginfo(nc, "%p is already registered for signals (provided %p)\n", expected, nc);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if(!no_winch_sig){
|
|
|
|
if(!no_winch_sig){
|
|
|
|
memset(&sa, 0, sizeof(sa));
|
|
|
|
memset(&sa, 0, sizeof(sa));
|
|
|
|
sa.sa_handler = sigwinch_handler;
|
|
|
|
sa.sa_handler = sigwinch_handler;
|
|
|
|