Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jun 2007 10:41:05 GMT
From:      Fredrik Lindberg <fli@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 122023 for review
Message-ID:  <200706201041.l5KAf5JW093603@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122023

Change 122023 by fli@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706201041.l5KAf5JW093603>