semaphore usage in libev?

Joachim Nilsson troglobit at
Wed Nov 18 20:59:03 CET 2009

Hi Marc!

Do you have any recommendations regarding the use of semaphores with
libev?  I.e. does it work, or should I try and avoid semaphores from
some particular watcher type?

I have a timer callbacks, signal handlers and socket listeners built
on top of libev watchers. I've added sem_wait() and sem_post() around
a critical piece of code entered by all of the above
handlers/callbacks/listeners to serialize the access.  So far it seems
to work, but I may not have stressed the system enough to trigger a
possible problem.

I looked around a bit, but couldn't seem to find any mention of "best
practices", or such, in the documentation or the mailing list.


More information about the libev mailing list