]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: define a new PREPARING state
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Nov 2015 22:33:55 +0000 (23:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Nov 2015 22:36:03 +0000 (23:36 +0100)
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.

src/libsystemd/sd-event/sd-event.c
src/systemd/sd-event.h

index e68d76708a99c766d7ba4a7cbc93c61afd084ad2..e8e3d7306ff6332307001e40cc3aa73b5dddfb02 100644 (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;
 
index d1cf02ca73f1bd190628a209930f5efd50740c68..fb97f7f28dc48d4a57be99832aa9790c67942f3d 100644 (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);