"subclassing" the watcher

Kandalintsev Alexandre exe at agava.com
Mon Sep 15 06:42:51 CEST 2008

> You must have misread something, the documentation never tells you that
> using a different type for a watcher argument works.
>>     ev_io_init (&stdin_watcher, stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
> stdin_watcher is not of type ev_io, you have to use &stdin_watcher.io  
> here
> if you want that.
Ok, but later in the documentation you cast "ev_io" to "my_io":

static void my_cb (struct ev_loop *loop, struct ev_io *w_, int revents)
     struct my_io *w = (struct my_io *)w_;

I think this is wrong becouse "w_" points to my_io->io and not to my_io,  
isn't it?

//Kandalintsev Alexandre

More information about the libev mailing list