1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

sd-event: define a new PREPARING state

We already have a state RUNNING and EXITING when we dispatch regular and
exit callbacks. Let's introduce a new state called PREPARING that is
active while we invoke preparation callbacks. This way we have a state
each for all three kinds of event handlers.

The states are currently not documented, hence let's add a new state to
the end, before we start documenting this.
This commit is contained in:
Lennart Poettering 2015-11-19 23:33:55 +01:00
parent 6680dd6b66
commit 0be6c2f617
2 changed files with 6 additions and 3 deletions

View File

@ -2437,7 +2437,9 @@ _public_ int sd_event_prepare(sd_event *e) {
e->iteration++;
e->state = SD_EVENT_PREPARING;
r = event_prepare(e);
e->state = SD_EVENT_INITIAL;
if (r < 0)
return r;

View File

@ -56,7 +56,8 @@ enum {
SD_EVENT_PENDING,
SD_EVENT_RUNNING,
SD_EVENT_EXITING,
SD_EVENT_FINISHED
SD_EVENT_FINISHED,
SD_EVENT_PREPARING,
};
enum {
@ -87,9 +88,9 @@ int sd_event_add_post(sd_event *e, sd_event_source **s, sd_event_handler_t callb
int sd_event_add_exit(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
int sd_event_prepare(sd_event *e);
int sd_event_wait(sd_event *e, uint64_t timeout);
int sd_event_wait(sd_event *e, uint64_t usec);
int sd_event_dispatch(sd_event *e);
int sd_event_run(sd_event *e, uint64_t timeout);
int sd_event_run(sd_event *e, uint64_t usec);
int sd_event_loop(sd_event *e);
int sd_event_exit(sd_event *e, int code);