diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-12 22:21:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-13 04:06:43 +0100 |
commit | 6203e07a83214a55bb1f88508fcda2005c601dea (patch) | |
tree | 51112fe80de37b9f7cfd59f703fafdc624ae02d7 /src/libsystemd-rtnl/sd-rtnl.c | |
parent | 6e41a3e53d858f30e131c62350f51465558ca55c (diff) |
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/libsystemd-rtnl/sd-rtnl.c')
-rw-r--r-- | src/libsystemd-rtnl/sd-rtnl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd-rtnl/sd-rtnl.c b/src/libsystemd-rtnl/sd-rtnl.c index 57d0b766f2..98d0f89e52 100644 --- a/src/libsystemd-rtnl/sd-rtnl.c +++ b/src/libsystemd-rtnl/sd-rtnl.c @@ -743,7 +743,7 @@ static int prepare_callback(sd_event_source *s, void *userdata) { return 1; } -static int quit_callback(sd_event_source *event, void *userdata) { +static int exit_callback(sd_event_source *event, void *userdata) { sd_rtnl *rtnl = userdata; assert(event); @@ -790,7 +790,7 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) { if (r < 0) goto fail; - r = sd_event_add_quit(rtnl->event, quit_callback, rtnl, &rtnl->quit_event_source); + r = sd_event_add_exit(rtnl->event, exit_callback, rtnl, &rtnl->exit_event_source); if (r < 0) goto fail; @@ -811,8 +811,8 @@ int sd_rtnl_detach_event(sd_rtnl *rtnl) { if (rtnl->time_event_source) rtnl->time_event_source = sd_event_source_unref(rtnl->time_event_source); - if (rtnl->quit_event_source) - rtnl->quit_event_source = sd_event_source_unref(rtnl->quit_event_source); + if (rtnl->exit_event_source) + rtnl->exit_event_source = sd_event_source_unref(rtnl->exit_event_source); if (rtnl->event) rtnl->event = sd_event_unref(rtnl->event); |