about providing the userdata for "ev_io"

Marc Lehmann schmorp at schmorp.de
Wed Mar 7 14:19:39 CET 2018

On Wed, Mar 07, 2018 at 03:18:32PM +0800, lingi <lingjip at qq.com> wrote:
> Hi, Is it possible to provide the userdata for "ev_io", which is similar to the function "void ev_set_userdata (struct ev_loop *loop, void *data)" ?

By default, every watcher has a "void *data" member that you can use for
this. If you embed libev, you can redefine EV_COMMON and have any number
(including none) of custom members in your watcher structures.

> I feel confused about it don't do this. 

Because having an accessor function for a public struct member seems
excessive (struct ev_loop is not public, so needs an accessor).

> In addtion to, I 'm glad to see the source code or it's mirror reside at github.com.

gthub is quite unsuitable for free software hosting in general due
to censorship and the fact it makes it hard to impossible to access
the software on github without running proprietary software (see the GNU
Ethical Repository Criteria Evaluations, where github gets the worst
possible score: https://www.gnu.org/software/repo-criteria-evaluation.html).

In addition, it's very hard to move away from github (or similar
services), so the best way to deal with github at the moment is simply not
to use it.

You are free to make a mirror yourself on github, of course, or use one of
the existing ones.

                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