diff options
author | marcus <marcus@FreeBSD.org> | 2005-07-03 14:11:00 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2005-07-03 14:11:00 +0800 |
commit | d742008602a1f1c21a1f65a09bdf1f19d10766e3 (patch) | |
tree | 805b6c2ddf4d8d7a70d36d59ed4221182c0fa90f /devel | |
parent | 32b42b53bd2eec975ff068f332459470ee7bada8 (diff) | |
download | freebsd-ports-graphics-d742008602a1f1c21a1f65a09bdf1f19d10766e3.tar.gz freebsd-ports-graphics-d742008602a1f1c21a1f65a09bdf1f19d10766e3.tar.zst freebsd-ports-graphics-d742008602a1f1c21a1f65a09bdf1f19d10766e3.zip |
Remove the kqueue watch from the mainloop before unref'ing it. This
eliminates one needless kevent system call.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/dbus/Makefile | 2 | ||||
-rw-r--r-- | devel/dbus/files/patch-bus_dir-watch.c | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/devel/dbus/Makefile b/devel/dbus/Makefile index 100433763e9..90d4c493318 100644 --- a/devel/dbus/Makefile +++ b/devel/dbus/Makefile @@ -7,7 +7,7 @@ PORTNAME= dbus PORTVERSION= 0.34 -PORTREVISION?= 2 +PORTREVISION?= 3 CATEGORIES?= devel gnome MASTER_SITES= http://dbus.freedesktop.org/releases/ diff --git a/devel/dbus/files/patch-bus_dir-watch.c b/devel/dbus/files/patch-bus_dir-watch.c index 0673a8caa8f..2eb1dfa1a88 100644 --- a/devel/dbus/files/patch-bus_dir-watch.c +++ b/devel/dbus/files/patch-bus_dir-watch.c @@ -1,5 +1,5 @@ --- bus/dir-watch.c.orig Tue Jun 14 22:31:38 2005 -+++ bus/dir-watch.c Sun Jul 3 01:40:21 2005 ++++ bus/dir-watch.c Sun Jul 3 02:07:14 2005 @@ -28,17 +28,25 @@ #include <stdlib.h> #include <unistd.h> @@ -28,7 +28,7 @@ /* use a static array to avoid handling OOM */ static int fds[MAX_DIRS_TO_WATCH]; static int num_fds = 0; -@@ -92,6 +100,141 @@ bus_drop_all_directory_watches (void) +@@ -92,6 +100,144 @@ bus_drop_all_directory_watches (void) } } @@ -41,6 +41,13 @@ +static int fds[MAX_DIRS_TO_WATCH]; +static int num_fds = 0; +static DBusWatch *watch = NULL; ++static DBusLoop *loop = NULL; ++ ++static dbus_bool_t ++_kqueue_watch_callback (DBusWatch *watch, unsigned int condition, void *data) ++{ ++ return dbus_watch_handle (watch, condition); ++} + +static dbus_bool_t +_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) @@ -63,7 +70,9 @@ + kq = -1; + if (watch != NULL) + { ++ _dbus_loop_remove_watch (loop, watch, _kqueue_watch_callback, NULL); + _dbus_watch_unref (watch); ++ watch = NULL; + } + pid = getpid (); + _dbus_verbose ("Sending SIGHUP signal since kqueue has been closed\n"); @@ -73,12 +82,6 @@ + return TRUE; +} + -+static dbus_bool_t -+_kqueue_watch_callback (DBusWatch *watch, unsigned int condition, void *data) -+{ -+ return dbus_watch_handle (watch, condition); -+} -+ +void +bus_watch_directory (const char *dir, void *userdata) +{ @@ -89,7 +92,6 @@ + + if (kq < 0) + { -+ DBusLoop *loop; + + kq = kqueue (); + if (kq < 0) @@ -118,6 +120,7 @@ + close (kq); + kq = -1; + _dbus_watch_unref (watch); ++ watch = NULL; + goto out; + } + } |