From: Nick Mathewson Date: Mon, 12 May 2008 01:03:36 +0000 (+0000) Subject: Make trunk event.c build happily on win32 under mingw. X-Git-Tag: release-2.0.1-alpha~299 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03fafae0068ed014dfe9ee97a3e150fbe6ff6ba0;p=libevent Make trunk event.c build happily on win32 under mingw. svn:r811 --- diff --git a/event.c b/event.c index 4c8d21f2..28ed52cb 100644 --- a/event.c +++ b/event.c @@ -29,6 +29,7 @@ #endif #ifdef WIN32 +#include #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN @@ -908,7 +909,7 @@ _event_initialized(struct event *ev, int need_fd) return 0; #ifdef WIN32 /* XXX Is this actually a sensible thing to check? -NM */ - if (need_fd && (ev)->ev_fd == INVALID_HANDLE_VALUE) + if (need_fd && (ev)->ev_fd == (evutil_socket_t)INVALID_HANDLE_VALUE) return 0; #endif return 1; @@ -1403,6 +1404,11 @@ evthread_set_id_callback(struct event_base *base, { #ifdef DISABLE_THREAD_SUPPORT event_errx(1, "%s: not compiled with thread support", __func__); +#endif +#ifdef WIN32 +#define LOCAL_SOCKETPAIR_AF AF_INET +#else +#define LOCAL_SOCKETPAIR_AF AF_UNIX #endif base->th_get_id = id_fn; base->th_owner_id = (*id_fn)(); @@ -1410,7 +1416,7 @@ evthread_set_id_callback(struct event_base *base, * If another thread wants to add a new event, we need to notify * the thread that owns the base to wakeup for rescheduling. */ - if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, + if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, base->th_notify_fd) == -1) event_err(1, "%s: socketpair", __func__);