about summary refs log tree commit homepage
path: root/queue_loop.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-04-21 09:30:56 +0000
committerEric Wong <normalperson@yhbt.net>2012-04-21 09:35:30 +0000
commitad44c3a24011d07db828a77a9e0c04809637db0d (patch)
treedb9bb93986b3e79de3a4edcb269260a87a6f4da7 /queue_loop.c
parent8d375156c8e6b8c0e728aaec4319e679674558b0 (diff)
downloadcmogstored-ad44c3a24011d07db828a77a9e0c04809637db0d.tar.gz
The kevent() function as implemented by libkqueue does not
support thread cancellation the same way a real kevent() (on
FreeBSD) appears to.  So pretend no implementation of kevent()
is cancelable and handle cancellation ourselves using
pthread_testcancel().  This allows us to support any platform
where kevent() may work, since it's unclear if other *BSDs
implement kevent() as a cancellation point.
Diffstat (limited to 'queue_loop.c')
-rw-r--r--queue_loop.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/queue_loop.c b/queue_loop.c
index 5f73e75..db30908 100644
--- a/queue_loop.c
+++ b/queue_loop.c
@@ -49,17 +49,6 @@ static void queue_loop_cleanup(void *arg)
         syslog(LOG_DEBUG, "mog_queue_loop[%lx] thread done", self);
 }
 
-static struct mog_fd *cancellable_queue_wait(struct mog_queue *q, int timeout)
-{
-        struct mog_fd *mfd;
-
-        mog_cancel_enable();
-        mfd = mog_idleq_wait(q, timeout);
-        mog_cancel_disable();
-
-        return mfd;
-}
-
 /* passed as a start_routine to pthread_create */
 void * mog_queue_loop(void *arg)
 {
@@ -111,7 +100,7 @@ void * mog_queue_loop(void *arg)
                          * Sleep until there's an event.  mog_accept_loop
                          * will push into epoll/kqueue to wake us up here.
                          */
-                        if ((mfd = cancellable_queue_wait(q, -1)))
+                        if ((mfd = mog_idleq_wait(q, MOG_CANCELABLE)))
                                 active_mfd = mog_queue_step(mfd);
                 }
         }