// something to give to WSAPoll, so we fake it with a local TCP socket. (ugh)
int pipe(int pipefd[2]);
+// pipe(socket)-specific read/write/close equivalents
+#define closepipe closesocket
+#define writepipe(s,buf,len) send(s, buf, len, 0)
+#define readpipe(s,buf,len) recv(s, buf, len, 0)
+
// Windows logically doesn't have uname, so we supply a replacement.
char c = 'W';
assert(s);
- write(s->wakeup_pipe[1], &c, sizeof(c));
+ writepipe(s->wakeup_pipe[1], &c, sizeof(c));
s->wakeup_issued = 1;
}
s->wakeup_issued = 0;
for(;;)
- if (read(s->wakeup_pipe[0], &c, sizeof(c)) != sizeof(c))
+ if (readpipe(s->wakeup_pipe[0], c, sizeof(c)) != sizeof(c))
break;
}
catta_free(s->pollfds);
if (s->wakeup_pipe[0] >= 0)
- closesocket(s->wakeup_pipe[0]);
+ closepipe(s->wakeup_pipe[0]);
if (s->wakeup_pipe[1] >= 0)
- closesocket(s->wakeup_pipe[1]);
+ closepipe(s->wakeup_pipe[1]);
catta_free(s);
winsock_exit(); // match the winsock_init in catta_simple_poll_new