diff --git a/event.c b/event.c index 14950238..0f10b569 100644 --- a/event.c +++ b/event.c @@ -2129,6 +2129,7 @@ evthread_notify_base_default(struct event_base *base) return (r < 0 && errno != EAGAIN) ? -1 : 0; } +#ifdef EVENT__HAVE_EVENTFD /* Helper callback: wake an event_base from another thread. This version * assumes that you have a working eventfd() implementation. */ static int @@ -2142,6 +2143,8 @@ evthread_notify_base_eventfd(struct event_base *base) return (r < 0) ? -1 : 0; } +#endif + /** Tell the thread currently running the event_loop for base (if any) that it * needs to stop waiting in its dispatch function (if it is) and process all @@ -2963,6 +2966,7 @@ event_set_mem_functions(void *(*malloc_fn)(size_t sz), } #endif +#ifdef EVENT__HAVE_EVENTFD static void evthread_notify_drain_eventfd(evutil_socket_t fd, short what, void *arg) { @@ -2978,6 +2982,7 @@ evthread_notify_drain_eventfd(evutil_socket_t fd, short what, void *arg) base->is_notify_pending = 0; EVBASE_RELEASE_LOCK(base, th_base_lock); } +#endif static void evthread_notify_drain_default(evutil_socket_t fd, short what, void *arg) @@ -3012,13 +3017,16 @@ evthread_make_base_notifiable(struct event_base *base) return 0; } +#ifdef EVENT__HAVE_EVENTFD base->th_notify_fd[0] = evutil_eventfd_(0, EVUTIL_EFD_CLOEXEC|EVUTIL_EFD_NONBLOCK); if (base->th_notify_fd[0] >= 0) { base->th_notify_fd[1] = -1; notify = evthread_notify_base_eventfd; cb = evthread_notify_drain_eventfd; - } else if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) { + } else +#endif + if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) { notify = evthread_notify_base_default; cb = evthread_notify_drain_default; } else { diff --git a/test/regress_buffer.c b/test/regress_buffer.c index 05f17906..dfb680b5 100644 --- a/test/regress_buffer.c +++ b/test/regress_buffer.c @@ -757,7 +757,7 @@ test_evbuffer_add_file(void *ptr) data = malloc(1024*512); tt_assert(data); for (i = 0; i < datalen; ++i) - data[i] = evutil_weakrand_(); + data[i] = (char)evutil_weakrand_(); } else { data = strdup("here is a relatively small string."); tt_assert(data);