summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.embed13
-rw-r--r--ev_win32.c7
2 files changed, 14 insertions, 6 deletions
diff --git a/README.embed b/README.embed
index a7e03ca..b80a23a 100644
--- a/README.embed
+++ b/README.embed
@@ -121,12 +121,13 @@ PREPROCESSOR SYMBOLS
EV_SELECT_IS_WINSOCKET
- When defined to 1, the select backend will assume that select
- doesn't understand file descriptors but wants osf handles on
- win32 (this is the case when the select to be used is the winsock
- select). This means that it will call _get_osfhandle on the fd to
- convert it to an OS handle. Should not be defined on non-win32
- platforms.
+ When defined to 1, the select backend will assume that
+ select/socket/connect etc. don't understand file descriptors but
+ wants osf handles on win32 (this is the case when the select to
+ be used is the winsock select). This means that it will call
+ _get_osfhandle on the fd to convert it to an OS handle. Otherwise,
+ it is assumed that all these functions actually work on fds, even
+ on win32. Should not be defined on non-win32 platforms.
EV_USE_POLL
diff --git a/ev_win32.c b/ev_win32.c
index 8357426..e95969d 100644
--- a/ev_win32.c
+++ b/ev_win32.c
@@ -73,8 +73,15 @@ ev_pipe (int filedes [2])
closesocket (listener);
+#if EV_SELECT_IS_WINSOCKET
+ filedes [0] = _open_osfhandle (sock [0], 0);
+ filedes [1] = _open_osfhandle (sock [1], 0);
+#else
+ /* when select isn't winsocket, we also expect socket, connect, accept etc.
+ * to work on fds */
filedes [0] = sock [0];
filedes [1] = sock [1];
+#endif
return 0;