ev_prepare watcher awkwardness

Thilo Schulz thilo at tjps.eu
Fri Apr 17 19:46:00 CEST 2015

Dear list, dear Mr. Lehmann, 

first I would like to thank you for this excellent piece of software.
I've been using it for quite some time.
In developing software using this event library, I've noticed a
few "nice to haves" that I'm going to lay out in this email and a next email
to this list.

It so happens in my software there is a a prepare watcher which may,
somewhere in the call tree, add another prepare watcher, that shall execute
before the process blocks for new events.
If memory serves correctly looking at libev code, as this new prepare watcher
has not been properly "collected" yet, it will only be executed _after_ the
upcoming select()/poll(). While this collect behaviour is sensible for
file descriptors, in the case of ev_prepare() watchers this is somewhat

I am currently working around this by always
also installing an idle watcher to make sure the program doesn't block for at
least one event loop iteration. But like I said, this solution is rather awkward.

I can have a look at it and try to write a patch if you're interested. Thought
I'd ask first.

Best regards,
Thilo Schulz

More information about the libev mailing list