diff options
| -rw-r--r-- | Changes | 3 | ||||
| -rw-r--r-- | ev.pod | 7 | ||||
| -rw-r--r-- | ev_select.c | 9 | 
3 files changed, 19 insertions, 0 deletions
@@ -1,5 +1,8 @@  Revision history for libev, a high-performance and full-featured event loop. +	- pass in the write fd set as except fd set under windows. windows +          is so uncontrollably lame that it requires this. +  3.41 Fri May 23 18:42:54 CEST 2008  	- work around an (undocumented) bug in winsocket select: if you            provide only empty fd sets then select returns WSAEINVAL. how sucky. @@ -3304,6 +3304,13 @@ way (note also that glib is the slowest event library known to man).  There is no supported compilation method available on windows except  embedding it into other applications. +Not a libev limitation but worth mentioning: windows apparently doesn't +accept large writes: instead of resulting in a partial write, windows will +either accept everything or return C<ENOBUFS> if the buffer is too large, +so make sure you only write small amounts into your sockets (less than a +megabyte seems safe, but thsi apparently depends on the amount of memory +available). +  Due to the many, low, and arbitrary limits on the win32 platform and  the abysmal performance of winsockets, using a large number of sockets  is not recommended (and not reasonable). If your program needs to use diff --git a/ev_select.c b/ev_select.c index fcebcc6..9c63f0d 100644 --- a/ev_select.c +++ b/ev_select.c @@ -134,7 +134,16 @@ select_poll (EV_P_ ev_tstamp timeout)    tv.tv_sec  = (long)timeout;    tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6); +#ifdef _WIN32 +  /* pass in the write set as except set. +   * the idea behind this is to work around a windows bug that causes +   * errors to be reported as an exception and not by setting +   * the writable bit. this is so uncontrollably lame. +   */ +  res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, (fd_set *)vec_wo, &tv); +#else    res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); +#endif    if (expect_false (res < 0))      {  | 
