]> granicus.if.org Git - libevent/commitdiff
make event_base_get_running_event build with threads disabled.
authorNick Mathewson <nickm@torproject.org>
Tue, 3 Apr 2012 18:53:00 +0000 (14:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 3 Apr 2012 18:53:00 +0000 (14:53 -0400)
event-internal.h
event.c

index 1a64ed42e645660cf63b76284ba568e29c360e60..f840058d3b3b422ce87a43343350623dc99901d2 100644 (file)
@@ -257,14 +257,14 @@ struct event_base {
        unsigned long th_owner_id;
        /** A lock to prevent conflicting accesses to this event_base */
        void *th_base_lock;
-       /** The event whose callback is executing right now */
-       struct event *current_event;
        /** A condition that gets signalled when we're done processing an
         * event with waiters on it. */
        void *current_event_cond;
        /** Number of threads blocking on current_event_cond. */
        int current_event_waiters;
 #endif
+       /** The event whose callback is executing right now */
+       struct event *current_event;
 
 #ifdef _WIN32
        /** IOCP support structure, if IOCP is enabled. */
diff --git a/event.c b/event.c
index 3cf96ad064ef4d23ebddd6e0270b2aa3ca4f7753..14950238e08163576f13afb29c005beeb81927f8 100644 (file)
--- a/event.c
+++ b/event.c
@@ -1428,8 +1428,8 @@ event_process_active_single_queue(struct event_base *base,
                        ev->ev_res & EV_WRITE ? "EV_WRITE " : " ",
                        ev->ev_callback));
 
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
                base->current_event = ev;
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
                base->current_event_waiters = 0;
 #endif
 
@@ -1449,8 +1449,8 @@ event_process_active_single_queue(struct event_base *base,
                }
 
                EVBASE_ACQUIRE_LOCK(base, th_base_lock);
-#ifndef EVENT__DISABLE_THREAD_SUPPORT
                base->current_event = NULL;
+#ifndef EVENT__DISABLE_THREAD_SUPPORT
                if (base->current_event_waiters) {
                        base->current_event_waiters = 0;
                        EVTHREAD_COND_BROADCAST(base->current_event_cond);