Using EV_CUSTOM for custom events

Marc Lehmann schmorp at
Sat Apr 28 14:03:01 CEST 2012

On Fri, Apr 27, 2012 at 07:09:29PM +0400, Konstantin Osipov <kostja.osipov at> wrote:
> Currently we use ev_async for that, but it involves writing
> into a pipe, and is thus slower than I would like it to be.

It only involves a pipe if you run on non-linux kernels (or use a very old
system), and only if it happens rarely. Only the first async wakeup in an
iteration involves messing with pipes (or an eventfd).

> Hence I was looking for ev_signal and EV_CUSTOM event type 
> as a replacement. 

Signals are likely far slower than even a pipe read and write (last i
timed it, handling a signal took >3000 cycles on my box, and an event fd
read+write was around 2200 cycles), and in addition, ev_signal uses the
exactly the same mechanism as ev_async, so it will probably take more than
twice the time.

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

More information about the libev mailing list