aboutsummaryrefslogtreecommitdiffhomepage
path: root/event.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-04 14:20:01 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-04 14:20:01 -0700
commit69446be1ee063771f2e0b498a50f9b0787ea70c7 (patch)
treebe5ecf3a473052475218df605d350a204666c750 /event.h
parentcc90f9cf803bc4aba928b2a80be451d9b717c5f0 (diff)
Signal handling cleanup and improved safety
Fixes issue where you couldn't control-C out of a loop (https://github.com/ridiculousfish/fishfish/issues/13) Also stops doing memory allocation in the signal handler (oops) https://github.com/ridiculousfish/fishfish/issues/27
Diffstat (limited to 'event.h')
-rw-r--r--event.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/event.h b/event.h
index 402b3594..c176a50a 100644
--- a/event.h
+++ b/event.h
@@ -123,6 +123,12 @@ void event_remove( event_t *event );
int event_get( event_t *criterion, std::vector<event_t *> *out );
/**
+ Returns whether an event listener is registered for the given signal.
+ This is safe to call from a signal handler.
+*/
+bool event_is_signal_observed(int signal);
+
+/**
Fire the specified event. The function_name field of the event must
be set to 0. If the event is of type EVENT_SIGNAL, no the event is
queued, and will be dispatched the next time event_fire is
@@ -140,6 +146,9 @@ int event_get( event_t *criterion, std::vector<event_t *> *out );
*/
void event_fire( event_t *event );
+/** Like event_fire, but takes a signal directly. */
+void event_fire_signal(int signal);
+
/**
Initialize the event-handling library
*/