chiark / gitweb /
sd-event: define a new PREPARING state
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Nov 2015 22:33:55 +0000 (23:33 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 17 May 2017 13:22:14 +0000 (15:22 +0200)
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/libelogind/sd-event/sd-event.c

index 5380d2178b126027965aa5c5f9233dc3d0f870fd..08608d49fc5376775281794cd9300de1da5f90bb 100644 (file)
@@ -2453,7 +2453,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;