I suggest you to add information about "FUNCTIONS CONTROLLING EVENT LOOPS" to several libev document sections.

Marc Lehmann schmorp at schmorp.de
Tue Jul 31 00:24:26 CEST 2018

On Mon, Jul 30, 2018 at 08:10:59PM +0900, 裕士辻 <kikikaikaikai at gmail.com> wrote:
> About two weeks ago, I asked you to "stop API of ev_once event?".
> Because I couldn't find userdata yet at that time. I only found ev_once to
> set user data in libev.

Can you explain the connection between the userdata api and your ev_once
question? It's not at all clear to me what one has to do with another.

In any case, it's trivial to associate userdata with an event loop:

   struct ev_loop *myloop;
   mydata myuserdata;

i.e., just store it wherever you store the loop. The userdata API is there
for cases where you only have a loop pointer, such as in the callbacks
mentioned in the documentation. Mentioning them in the watcher specific
section cna only be confusing, as they are not related and will not be

> It was difficult for me to find "userdata" area in WATCHER.

Because there isn't any - the userdata api is for the loop, not for
watchers, and certainly not for ev_once. To associate custom data with
ev_once, you pass the custom data to ev_once (I have tried to clarify this
in the documentation for ev_once).

> After that, I could find it by your suggestion and some information.
> And I thought 'Oh, I'm too fool, why didn't I read "FUNCTIONS CONTROLLING

If you are using userdata somehow because you use ev_once, then you are
probably doing it wrong, but it's hard to tell.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list