… | |
… | |
139 | struct timeval tv; |
139 | struct timeval tv; |
140 | int res; |
140 | int res; |
141 | int fd_setsize; |
141 | int fd_setsize; |
142 | |
142 | |
143 | EV_RELEASE_CB; |
143 | EV_RELEASE_CB; |
144 | tv.tv_sec = (long)timeout; |
144 | EV_TV_SET (tv, timeout); |
145 | tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6); |
|
|
146 | |
145 | |
147 | #if EV_SELECT_USE_FD_SET |
146 | #if EV_SELECT_USE_FD_SET |
148 | fd_setsize = sizeof (fd_set); |
147 | fd_setsize = sizeof (fd_set); |
149 | #else |
148 | #else |
150 | fd_setsize = vec_max * NFDBYTES; |
149 | fd_setsize = vec_max * NFDBYTES; |
… | |
… | |
182 | else |
181 | else |
183 | errno -= WSABASEERR; |
182 | errno -= WSABASEERR; |
184 | #endif |
183 | #endif |
185 | |
184 | |
186 | #ifdef _WIN32 |
185 | #ifdef _WIN32 |
187 | /* select on windows errornously returns EINVAL when no fd sets have been |
186 | /* select on windows erroneously returns EINVAL when no fd sets have been |
188 | * provided (this is documented). what microsoft doesn't tell you that this bug |
187 | * provided (this is documented). what microsoft doesn't tell you that this bug |
189 | * exists even when the fd sets _are_ provided, so we have to check for this bug |
188 | * exists even when the fd sets _are_ provided, so we have to check for this bug |
190 | * here and emulate by sleeping manually. |
189 | * here and emulate by sleeping manually. |
191 | * we also get EINVAL when the timeout is invalid, but we ignore this case here |
190 | * we also get EINVAL when the timeout is invalid, but we ignore this case here |
192 | * and assume that EINVAL always means: you have to wait manually. |
191 | * and assume that EINVAL always means: you have to wait manually. |