… | |
… | |
168 | static int pendingmax, pendingcnt; |
168 | static int pendingmax, pendingcnt; |
169 | |
169 | |
170 | static void |
170 | static void |
171 | event (W w, int events) |
171 | event (W w, int events) |
172 | { |
172 | { |
|
|
173 | if (w->pending) |
|
|
174 | { |
|
|
175 | pendings [w->pending - 1].events |= events; |
|
|
176 | return; |
|
|
177 | } |
|
|
178 | |
173 | w->pending = ++pendingcnt; |
179 | w->pending = ++pendingcnt; |
174 | array_needsize (pendings, pendingmax, pendingcnt, ); |
180 | array_needsize (pendings, pendingmax, pendingcnt, ); |
175 | pendings [pendingcnt - 1].w = w; |
181 | pendings [pendingcnt - 1].w = w; |
176 | pendings [pendingcnt - 1].events = events; |
182 | pendings [pendingcnt - 1].events = events; |
177 | } |
183 | } |
… | |
… | |
255 | for (fd = 0; fd < anfdmax; ++fd) |
261 | for (fd = 0; fd < anfdmax; ++fd) |
256 | if (anfds [fd].events) |
262 | if (anfds [fd].events) |
257 | if (fcntl (fd, F_GETFD) == -1 && errno == EBADF) |
263 | if (fcntl (fd, F_GETFD) == -1 && errno == EBADF) |
258 | while (anfds [fd].head) |
264 | while (anfds [fd].head) |
259 | { |
265 | { |
|
|
266 | ev_io_stop (anfds [fd].head); |
260 | event ((W)anfds [fd].head, EV_ERROR | EV_READ | EV_WRITE | EV_TIMEOUT); |
267 | event ((W)anfds [fd].head, EV_ERROR | EV_READ | EV_WRITE | EV_TIMEOUT); |
261 | ev_io_stop (anfds [fd].head); |
|
|
262 | } |
268 | } |
263 | } |
269 | } |
264 | |
270 | |
265 | /*****************************************************************************/ |
271 | /*****************************************************************************/ |
266 | |
272 | |