diff options
author | axel <axel@liljencrantz.se> | 2006-05-15 08:27:58 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-05-15 08:27:58 +1000 |
commit | 3d601bd75179e579bd76617c85f67c7fe0fca2f7 (patch) | |
tree | 13482e75d739c3048e0a49277776bfebbd2c24f9 | |
parent | c9deea223769c1615e98ed220c45c8a273a07dbe (diff) |
Remove superflous event_signal_listen function, replace all calls to it with event_get
darcs-hash:20060514222758-ac50b-de4457154510b89d1c9b893bc39f06a23c8fc08f.gz
-rw-r--r-- | event.c | 21 | ||||
-rw-r--r-- | event.h | 5 | ||||
-rw-r--r-- | signal.c | 16 |
3 files changed, 13 insertions, 29 deletions
@@ -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; i<al_get_count( events ); i++ ) - { - event_t *e = (event_t *)al_get( events, i ); - - if( e->type == EVENT_SIGNAL && - (e->param1.signal == signal || e->param1.signal == EVENT_ANY_SIGNAL) ) - { - return 1; - } - } - return 0; - - -} @@ -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 @@ -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 |