mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-18 08:49:57 -04:00
Fix compilation with threading disabled.
svn:r1546
This commit is contained in:
parent
d7d1f1da09
commit
767eb70f50
@ -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
|
||||
}
|
||||
|
2
evdns.c
2
evdns.c
@ -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;
|
||||
|
||||
|
2
event.c
2
event.c
@ -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))
|
||||
|
4
poll.c
4
poll.c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user