[systemd-devel] sd_event_run

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Apr 12 18:51:16 PDT 2015


On Sun, Apr 12, 2015 at 06:42:45PM +0200, Lennart Poettering wrote:
> On Sat, 11.04.15 23:52, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > On Fri, Apr 10, 2015 at 06:14:40PM +0200, Lennart Poettering wrote:
> > > On Sat, 14.03.15 12:19, Tom Gundersen (teg at jklm.no) wrote:
> > > 
> > > > > 1. shouldn't SD_EVENT_PASSIVE become SD_EVENT_INITIAL? "passive" seems strange
> > > > >    in this context.
> > > 
> > > I found it weird to name this INITIAL (or "INIT" or something like
> > > that) since we would return to it every single iteration... For me
> > > "init" kinda implies it's something "fresh", "unused", and hence not
> > > really something we routinely come back to...
> > In a sense it is "fresh" and "unused", because the state after doing
> > an interation of the loop is exactly the same as if the loop never run.
> > (E.g. I don't think it would be wrong to say "I cleaned the couch and
> > restored it to its initial state", even though it obviously has been used.)
> > 
> > "Passive" was confusing, so "initial", even if imperfect, seems an
> > improvement. We really want to say "the state in which you started",
> > without implying whether we have been there the whole time or not.
> > I don't know if there's a better word.
> 
> glib calls the respective state "initial" btw... I didn't like the
> name though, when I got inspiration from it...
> 
> > > > >    Similarly, SD_EVENT_ARMED seems more self-explanatory than PREPARED.
> > > > >    (I don't like PREPARED because it is not obvious whether sources are
> > > > >    prepared to wait on, or events are prepared to be reaped.)
> > > 
> > > I called this "prepared" since it what's _prepare() is supposed to get
> > > into...
> > > 
> > > But ARMED is fine too...
> > 
> > We really should get some native speakers to help out with this :)
> > 
> > Maybe sd_event_prepare should be renamed to sd_event_arm?
> 
> The "prepare" state I stole from glib:
> 
> https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html
> 
> It's probably a good idea to not invent new naming here, if glib
> already established the name.
OK.

I added the link you posted to sd_event_run(3) — it might be a useful
resource for somebody trying to wrap their head around this.

Zbyszek


More information about the systemd-devel mailing list