MCPcopy Create free account
hub / github.com/3rdparty/libprocess / pollCallback

Function pollCallback

src/posix/libevent/libevent_poll.cpp:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34
35void 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
56void pollDiscard(const std::weak_ptr<event>& ev, short events)

Callers

nothing calls this directly

Calls 4

hasDiscardMethod · 0.80
futureMethod · 0.80
discardMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected