diff options
-rw-r--r-- | defer-internal.h | 5 | ||||
-rw-r--r-- | evdns.c | 2 | ||||
-rw-r--r-- | event.c | 2 | ||||
-rw-r--r-- | poll.c | 4 |
4 files changed, 13 insertions, 0 deletions
diff --git a/defer-internal.h b/defer-internal.h index cde6e903..a1b1d2c8 100644 --- a/defer-internal.h +++ b/defer-internal.h @@ -81,6 +81,10 @@ void event_deferred_cb_cancel(struct deferred_cb_queue *, struct deferred_cb *); */ void event_deferred_cb_schedule(struct deferred_cb_queue *, struct deferred_cb *); +#ifdef _EVENT_DISABLE_THREAD_SUPPORT +#define LOCK_DEFERRED_QUEUE(q) (void)0 +#define UNLOCK_DEFERRED_QUEUE(q) (void)0 +#else #define LOCK_DEFERRED_QUEUE(q) \ do { \ if ((q)->lock) \ @@ -94,6 +98,7 @@ void event_deferred_cb_schedule(struct deferred_cb_queue *, struct deferred_cb * _evthread_locking_fn(EVTHREAD_UNLOCK|EVTHREAD_WRITE, \ (q)->lock); \ } while (0) +#endif #ifdef __cplusplus } @@ -2114,7 +2114,9 @@ evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, stru static void evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) { struct evdns_request *const req = (struct evdns_request *) arg; +#ifndef _EVENT_DISABLE_THREAD_SUPPORT struct evdns_base *base = req->base; +#endif (void) fd; (void) events; @@ -347,6 +347,7 @@ event_base_new_with_config(struct event_config *cfg) base->th_notify_fd[0] = -1; base->th_notify_fd[1] = -1; +#ifndef _EVENT_DISABLE_THREAD_SUPPORT if (!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK)) { int r; EVTHREAD_ALLOC_LOCK(base->th_base_lock); @@ -358,6 +359,7 @@ event_base_new_with_config(struct event_config *cfg) return NULL; } } +#endif #ifdef WIN32 if (cfg && (cfg->flags & EVENT_BASE_FLAG_STARTUP_IOCP)) @@ -125,6 +125,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv) nfds = pop->nfds; +#ifndef _EVENT_DISABLE_THREAD_SUPPORT if (base->th_base_lock) { /* If we're using this backend in a multithreaded setting, * then we need to work on a copy of event_set, so that we can @@ -147,6 +148,9 @@ poll_dispatch(struct event_base *base, struct timeval *tv) } else { event_set = pop->event_set; } +#else + event_set = pop->event_set; +#endif if (tv != NULL) msec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000; |