summaryrefslogtreecommitdiff
path: root/src/systemd/sd-event.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-12 22:21:25 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-13 04:06:43 +0100
commit6203e07a83214a55bb1f88508fcda2005c601dea (patch)
tree51112fe80de37b9f7cfd59f703fafdc624ae02d7 /src/systemd/sd-event.h
parent6e41a3e53d858f30e131c62350f51465558ca55c (diff)
downloadsystemd-6203e07a83214a55bb1f88508fcda2005c601dea.tar.gz
event: rework sd-event exit logic
With this change a failing event source handler will not cause the entire event loop to fail. Instead, we just disable the specific event source, log a message at debug level and go on. This also introduces a new concept of "exit code" which can be stored in the event loop and is returned by sd_event_loop(). We also rename "quit" to "exit" everywhere else. Altogether this should make things more robus and keep errors local while still providing a way to return event loop errors in a clear way.
Diffstat (limited to 'src/systemd/sd-event.h')
-rw-r--r--src/systemd/sd-event.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
index 3551077f34..c7c45067fe 100644
--- a/src/systemd/sd-event.h
+++ b/src/systemd/sd-event.h
@@ -53,7 +53,7 @@ enum {
enum {
SD_EVENT_PASSIVE,
SD_EVENT_RUNNING,
- SD_EVENT_QUITTING,
+ SD_EVENT_EXITING,
SD_EVENT_FINISHED
};
@@ -82,15 +82,15 @@ int sd_event_add_realtime(sd_event *e, uint64_t usec, uint64_t accuracy, sd_even
int sd_event_add_signal(sd_event *e, int sig, sd_event_signal_handler_t callback, void *userdata, sd_event_source **s);
int sd_event_add_child(sd_event *e, pid_t pid, int options, sd_event_child_handler_t callback, void *userdata, sd_event_source **s);
int sd_event_add_defer(sd_event *e, sd_event_handler_t callback, void *userdata, sd_event_source **s);
-int sd_event_add_quit(sd_event *e, sd_event_handler_t callback, void *userdata, sd_event_source **s);
+int sd_event_add_exit(sd_event *e, sd_event_handler_t callback, void *userdata, sd_event_source **s);
int sd_event_run(sd_event *e, uint64_t timeout);
int sd_event_loop(sd_event *e);
+int sd_event_exit(sd_event *e, int code);
int sd_event_get_state(sd_event *e);
int sd_event_get_tid(sd_event *e, pid_t *tid);
-int sd_event_get_quit(sd_event *e);
-int sd_event_request_quit(sd_event *e);
+int sd_event_get_exit_code(sd_event *e, int *code);
int sd_event_get_now_realtime(sd_event *e, uint64_t *usec);
int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec);
int sd_event_set_watchdog(sd_event *e, int b);