Hi Niels and lurkers,
I am the author of Event::Lib which are Perl bindings for libevent. I
was lately made aware that non-persistent events were triggered more
than once under OpenBSD, most notably EV_READ|EV_WRITE-events which lead
to all kinds of interesting segfaults as my module clearly wasn't
expecting that to happen.
Here is a small patch that fixes the problem. The problem is that
kq_dispatch unsets the EVLIST_X_KQINKERNEL flag before kq_del is called.
kq_del then thinks the event has already been deleted and returns
immediately.
--- kqueue.c.orig 2005-12-14 12:08:14.000000000 +0100
+++ kqueue.c 2005-12-14 12:08:35.000000000 +0100
@@ -267,7 +267,6 @@ kq_dispatch(struct event_base *base, voi
continue;
if (!(ev->ev_events & EV_PERSIST)) {
- ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
event_del(ev);
}
And I have one small question with EV_READ|EV_WRITE events: Am I correct
in assuming that an event-handlers second argument, being the type of
event, can be the bitwise ORing of these two when the fd can both be
read from and written to? So far I always assumed it's either but not
both of them so I used '==' instead of '&' to test which event occured.
This is also what libevent's manpage implies:
The function fn will be called with the file descriptor that
triggered the event and the type of event which will be either
EV_TIMEOUT, EV_SIGNAL, EV_READ, or EV_WRITE.
Finally, and this goes to Niels, I may say that I have seldom come
across such a cleanly written C library. It's a breeze finding and
understanding things in the source, something that cannot be said about
many other C libraries! Kudos to Niels!
Cheers,
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users