semaphore usage in libev?

Marc Lehmann schmorp at
Wed Nov 18 21:08:09 CET 2009

On Wed, Nov 18, 2009 at 08:59:03PM +0100, Joachim Nilsson <troglobit at> wrote:
> 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 think it's two rather orthogonal things - libev doesn't use any kind of
semaphores internally, so will hardly collide.

> 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.

I guess you cna safely treta it like many other thing not mentioned in the
documentation, such as "does it work with prime numbers", "does it work with
my toaster", "will it interfere with iceweasel on the same system".

You typically run into problems if you mix multiple event libraries, as
most event sources under unix are single-use points (signals for example),
but since libev doesn't use semaphores itself, you are safe.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list