ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_select.c
(Generate patch)

Comparing libev/ev_select.c (file contents):
Revision 1.40 by root, Tue Jan 6 19:46:56 2009 UTC vs.
Revision 1.44 by root, Fri Jul 10 00:36:21 2009 UTC

70 if (oev == nev) 70 if (oev == nev)
71 return; 71 return;
72 72
73 { 73 {
74#if EV_SELECT_USE_FD_SET 74#if EV_SELECT_USE_FD_SET
75 assert (("libev: fd >= FD_SETSIZE passed to fd_set-based select backend", fd < FD_SETSIZE));
76 75
77 #if EV_SELECT_IS_WINSOCKET 76 #if EV_SELECT_IS_WINSOCKET
78 SOCKET handle = anfds [fd].handle; 77 SOCKET handle = anfds [fd].handle;
79 #else 78 #else
80 int handle = fd; 79 int handle = fd;
81 #endif 80 #endif
81
82 assert (("libev: fd >= FD_SETSIZE passed to fd_set-based select backend", fd < FD_SETSIZE));
82 83
83 /* FD_SET is broken on windows (it adds the fd to a set twice or more, 84 /* FD_SET is broken on windows (it adds the fd to a set twice or more,
84 * which eventually leads to overflows). Need to call it only on changes. 85 * which eventually leads to overflows). Need to call it only on changes.
85 */ 86 */
86 #if EV_SELECT_IS_WINSOCKET 87 #if EV_SELECT_IS_WINSOCKET
137{ 138{
138 struct timeval tv; 139 struct timeval tv;
139 int res; 140 int res;
140 int fd_setsize; 141 int fd_setsize;
141 142
143 EV_SUSPEND_CB;
142 tv.tv_sec = (long)timeout; 144 tv.tv_sec = (long)timeout;
143 tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6); 145 tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6);
144 146
145#if EV_SELECT_USE_FD_SET 147#if EV_SELECT_USE_FD_SET
146 fd_setsize = sizeof (fd_set); 148 fd_setsize = sizeof (fd_set);
163 fd_setsize = anfdmax < FD_SETSIZE ? anfdmax : FD_SETSIZE; 165 fd_setsize = anfdmax < FD_SETSIZE ? anfdmax : FD_SETSIZE;
164 res = select (fd_setsize, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); 166 res = select (fd_setsize, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv);
165#else 167#else
166 res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); 168 res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv);
167#endif 169#endif
170 EV_RESUME_CB;
168 171
169 if (expect_false (res < 0)) 172 if (expect_false (res < 0))
170 { 173 {
171 #if EV_SELECT_IS_WINSOCKET 174 #if EV_SELECT_IS_WINSOCKET
172 errno = WSAGetLastError (); 175 errno = WSAGetLastError ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines