Make trunk event.c build happily on win32 under mingw.

svn:r811
This commit is contained in:
Nick Mathewson 2008-05-12 01:03:36 +00:00
parent 054159f59c
commit 03fafae006

10
event.c
View File

@ -29,6 +29,7 @@
#endif
#ifdef WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#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__);