1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

sd-event: simplify sd_event_run()

This commit is contained in:
Lennart Poettering 2015-04-10 18:45:39 +02:00
parent 5c5ccf12b6
commit 53bac4e0e3

View File

@ -2490,24 +2490,20 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
assert_return(e->state == SD_EVENT_INITIAL, -EBUSY); assert_return(e->state == SD_EVENT_INITIAL, -EBUSY);
r = sd_event_prepare(e); r = sd_event_prepare(e);
if (r > 0) { if (r == 0)
r = sd_event_dispatch(e); /* There was nothing? Then wait... */
if (r < 0) r = sd_event_wait(e, timeout);
return r;
else
return 1;
} else if (r < 0)
return r;
r = sd_event_wait(e, timeout);
if (r > 0) { if (r > 0) {
/* There's something now, then let's dispatch it */
r = sd_event_dispatch(e); r = sd_event_dispatch(e);
if (r < 0) if (r < 0)
return r; return r;
else
return 1; return 1;
} else }
return r;
return r;
} }
_public_ int sd_event_loop(sd_event *e) { _public_ int sd_event_loop(sd_event *e) {