PERFORCE change 122023 for review
Fredrik Lindberg
fli at FreeBSD.org
Wed Jun 20 10:41:06 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122023
Change 122023 by fli at fli_genesis on 2007/06/20 10:40:18
- Allow the same event engine to execute the handler again
for serialized events.
Affected files ...
.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/event.c#3 edit
.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/event.h#3 edit
Differences ...
==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/event.c#3 (text+ko) ====
@@ -137,6 +137,7 @@
ev = (struct event *)arg.ptr;
MDNS_INIT_ASSERT(ev, ev_magic);
+again:
switch (ev->ev_type) {
case EVENT_TYPE_IO:
ret = ev->ev_cb.ev_handler.io(&ev->ev_data.io, ev->ev_handler_arg);
@@ -150,10 +151,18 @@
}
EV_WLOCK(ev);
+ if ((ev->ev_flags & EVENT_FLAG_EX) && ev->ev_redo > 0) {
+ ev->ev_redo--;
+ EV_UNLOCK(ev);
+ dprintf(DEBUG_EVENT, "Executing event again ev=%x", ev);
+ goto again;
+ }
ev->ev_refcnt--;
if (ev->ev_flags & EVENT_FLAG_DYING) {
evl = ev->ev_evl;
- remove_event(evl, ev, NULL);
+ if (remove_event(evl, ev, NULL) == 1) {
+ EV_UNLOCK(ev);
+ }
}
else {
EV_UNLOCK(ev);
@@ -226,7 +235,8 @@
/* Exclusive event already in progress */
if ((ev->ev_flags & EVENT_FLAG_EX) && ev->ev_refcnt > 0) {
dprintf(DEBUG_EVENT,
- "Exclusive event already in progress ev=%x", ev);
+ "Exclusive event already in progress ev=%x", ev);
+ ev->ev_redo++;
EV_UNLOCK(ev);
continue;
}
==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/event.h#3 (text+ko) ====
@@ -123,6 +123,7 @@
int ev_flags;
#define EVENT_FLAG_EX 0x1 /* exclusive event (refcnt=1) */
#define EVENT_FLAG_DYING 0x2 /* event is dying */
+ int ev_redo;
int ev_type; /* event type */
#define EVENT_TYPE_IO 0x1
#define EVENT_TYPE_TMR 0x2
More information about the p4-projects
mailing list