diff --git a/event.c b/event.c index 6c42414e7..88eaac5b1 100644 --- a/event.c +++ b/event.c @@ -654,24 +654,3 @@ void event_free( event_t *e ) free( e ); } -int event_signal_listen( int signal ) -{ - int i; - - if( !events ) - return 0; - - for( i=0; itype == EVENT_SIGNAL && - (e->param1.signal == signal || e->param1.signal == EVENT_ANY_SIGNAL) ) - { - return 1; - } - } - return 0; - - -} diff --git a/event.h b/event.h index 9b09938e4..9bd3f81bd 100644 --- a/event.h +++ b/event.h @@ -136,9 +136,4 @@ void event_free( event_t *e ); */ const wchar_t *event_get_desc( event_t *e ); -/** - Returns a non-zero status if there are event listeners that fire on the specified signal -*/ -int event_signal_listen( int signal ); - #endif diff --git a/signal.c b/signal.c index 8b886429b..29e3e4667 100644 --- a/signal.c +++ b/signal.c @@ -426,7 +426,11 @@ static void default_handler(int signal, siginfo_t *info, void *context) e.param1.signal = signal; e.function_name=0; - event_fire( &e ); + if( event_get( &e, 0 ) ) + { + + event_fire( &e ); + } } /** @@ -443,7 +447,13 @@ static void handle_winch( int sig, siginfo_t *info, void *context ) */ static void handle_hup( int sig, siginfo_t *info, void *context ) { - if( event_signal_listen( SIGHUP ) ) + event_t e; + + e.type=EVENT_SIGNAL; + e.param1.signal = SIGHUP; + e.function_name=0; + + if( event_get( &e, 0 ) ) { default_handler( sig, 0, 0 ); } @@ -502,7 +512,7 @@ void signal_set_handlers() sigemptyset( & act.sa_mask ); act.sa_flags=SA_SIGINFO; act.sa_sigaction = &default_handler; - + /* First reset everything to a use default_handler, a function whose sole action is to fire of an event