perl EV::Glib can't poll G_IO_OUT

common at gmx.ch common at gmx.ch
Sat Jan 31 01:46:31 CET 2009


Hi,

actually I did not use the perl EV::Glib binding, but had a look to 
check how to embed a glib main loop into libev using the EV::Glib code 
as an example as pointed out in the documentation.

I got the idea, copied major parts of the EV::Glib code, and it did not 
work.

Tracking the problem, it turned out the EV::Glib code is buggy and can't 
work if used to poll for G_IO_OUT.

In check_cb (EV_P_ ev_check *w, int revents)
...
           pfd->revents |= pfd->events &
             ((revents & EV_READ ? G_IO_IN : 0)
              | (revents & EV_READ ? G_IO_OUT : 0));
...


it's got to be:

...
           pfd->revents |= pfd->events &
             ((revents & EV_READ ? G_IO_IN : 0)
              | (revents & EV_WRITE ? G_IO_OUT : 0));
...


According to CVS, this was broken for 13 months now, starting with 
Glib.xs revision 1.1.

I had a look on Glib::EV too, and the same problem exists there too.

In io_cb (EV_P_ ev_io *w, int revents)
.......
   s->pfd->revents |= s->pfd->events &
     ((revents & EV_READ ? G_IO_IN : 0)
      | (revents & EV_READ ? G_IO_OUT : 0));
.......




MfG
Markus



More information about the libev mailing list