From: Nick Mathewson Date: Mon, 19 Jan 2009 19:46:03 +0000 (+0000) Subject: Debug and enable pipe notification X-Git-Tag: release-2.0.1-alpha~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34d2fd063472d088fea1d7730123cdbda93cc0db;p=libevent Debug and enable pipe notification svn:r1021 --- diff --git a/event.c b/event.c index 124aa07a..a95b79d8 100644 --- a/event.c +++ b/event.c @@ -1043,7 +1043,11 @@ evthread_notify_base(struct event_base *base, ev_uint8_t msg) char buf[1]; int r; buf[0] = (char)msg; +#ifdef WIN32 r = send(base->th_notify_fd[1], buf, 1, 0); +#else + r = write(base->th_notify_fd[1], buf, 1); +#endif return (r < 0) ? -1 : 0; } @@ -1506,7 +1510,11 @@ evthread_notification_callback(int fd, short what, void *arg) int n, i; /* we're draining the socket */ +#ifdef WIN32 while ((n = recv(fd, (char*)buf, sizeof(buf), 0)) != -1) { +#else + while ((n = read(fd, (char*)buf, sizeof(buf))) != -1) { +#endif for (i=0;ith_notify_fd[0] >= 0) return 0; -#if defined(XXX_EVENT_HAVE_PIPE) +#if defined(_EVENT_HAVE_PIPE) if ((base->evsel->features & EV_FEATURE_FDS)) { if (pipe(base->th_notify_fd) < 0) - event_warn(1, "%s: pipe", __func__); + event_warn("%s: pipe", __func__); } if (base->th_notify_fd[0] < 0) #endif