| 33 | |
| 34 | |
| 35 | void pollCallback(evutil_socket_t, short what, void* arg) |
| 36 | { |
| 37 | Poll* poll = reinterpret_cast<Poll*>(arg); |
| 38 | |
| 39 | if (poll->promise.future().hasDiscard()) { |
| 40 | poll->promise.discard(); |
| 41 | } else { |
| 42 | // Convert libevent specific EV_READ / EV_WRITE to io::* specific |
| 43 | // values of these enumerations. |
| 44 | short events = |
| 45 | ((what & EV_READ) ? io::READ : 0) | ((what & EV_WRITE) ? io::WRITE : 0); |
| 46 | |
| 47 | poll->promise.set(events); |
| 48 | } |
| 49 | |
| 50 | // Deleting the `poll` also destructs `ev` and hence triggers `event_free`, |
| 51 | // which makes the event non-pending. |
| 52 | delete poll; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | void pollDiscard(const std::weak_ptr<event>& ev, short events) |
nothing calls this directly
no test coverage detected