Does libev provide stop API of ev_once event?

Marc Lehmann schmorp at
Tue Jul 17 09:33:03 CEST 2018

On Sat, Jul 14, 2018 at 01:43:07AM +0900, 裕士辻 <kikikaikaikai at> wrote:
> I use ev_once, it's very convenience. But I have a problem about it.
> I seem there is no stop API for ev_once, isn't it?

No, there isn't. If you need the ability to stop watchers, you need to
create one with the other API functions.

I suggest you look at the implementation of ev_once in ev.c and roll your
own, as ev_once is close to trivial - it basically malloc's a struct with
an ev_timer and an ev_io watcher and starts them, freeing the struct when
the event fires.

Adding a stop API seemingly makes little sense, as ev_once is provided for
just those cases where you don't need this functionality, for everything
else you can use a normal watcher.

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

More information about the libev mailing list