Event loop callback when I/O is ready on polling file descriptor.
| 47 | |
| 48 | // Event loop callback when I/O is ready on polling file descriptor. |
| 49 | void polled(struct ev_loop* loop, ev_io* watcher, int revents) |
| 50 | { |
| 51 | Poll* poll = (Poll*) watcher->data; |
| 52 | |
| 53 | ev_io_stop(loop, poll->watcher.io.get()); |
| 54 | |
| 55 | // Stop the async watcher (also clears if pending so 'discard_poll' |
| 56 | // will not get invoked and we can delete 'poll' here). |
| 57 | ev_async_stop(loop, poll->watcher.async.get()); |
| 58 | |
| 59 | poll->promise.set(revents); |
| 60 | |
| 61 | delete poll; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | // Event loop callback when future associated with polling file |