mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Make trunk event.c build happily on win32 under mingw.
svn:r811
This commit is contained in:
parent
054159f59c
commit
03fafae006
10
event.c
10
event.c
@ -29,6 +29,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
#include <winsock2.h>
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
@ -908,7 +909,7 @@ _event_initialized(struct event *ev, int need_fd)
|
|||||||
return 0;
|
return 0;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* XXX Is this actually a sensible thing to check? -NM */
|
/* 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;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
@ -1403,6 +1404,11 @@ evthread_set_id_callback(struct event_base *base,
|
|||||||
{
|
{
|
||||||
#ifdef DISABLE_THREAD_SUPPORT
|
#ifdef DISABLE_THREAD_SUPPORT
|
||||||
event_errx(1, "%s: not compiled with thread support", __func__);
|
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
|
#endif
|
||||||
base->th_get_id = id_fn;
|
base->th_get_id = id_fn;
|
||||||
base->th_owner_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
|
* If another thread wants to add a new event, we need to notify
|
||||||
* the thread that owns the base to wakeup for rescheduling.
|
* 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)
|
base->th_notify_fd) == -1)
|
||||||
event_err(1, "%s: socketpair", __func__);
|
event_err(1, "%s: socketpair", __func__);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user