18 enum class UVPollEvent: std::underlying_type_t<uv_poll_event> {
19 READABLE = UV_READABLE,
20 WRITABLE = UV_WRITABLE,
21 DISCONNECT = UV_DISCONNECT,
22 PRIORITIZED = UV_PRIORITIZED
36 : flags{std::move(events)}
70 static void startCallback(uv_poll_t *handle,
int status,
int events) {
72 if(status) { poll.publish(
ErrorEvent{status}); }
73 else { poll.publish(
PollEvent{
static_cast<std::underlying_type_t<Event>
>(events)}); }
77 using Event = details::UVPollEvent;
79 explicit PollHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref,
int desc)
80 :
Handle{ca, std::move(ref)}, tag{FD}, fd{desc}
84 :
Handle{ca, std::move(ref)}, tag{SOCKET}, socket{sock}
92 return (tag == SOCKET)
93 ? initialize(&uv_poll_init_socket, socket)
94 : initialize(&uv_poll_init, fd);
117 invoke(&uv_poll_start,
get(), flags, &startCallback);
147 invoke(&uv_poll_stop,
get());
151 enum { FD, SOCKET } tag;
154 OSSocketHandle::Type socket;
bool init()
Initializes the handle.
void stop()
Stops polling the file descriptor.
void start(Flags< Event > flags)
Starts polling the file descriptor.
details::UVTypeWrapper< uv_os_sock_t > OSSocketHandle
void start(Event event)
Starts polling the file descriptor.
Flags< details::UVPollEvent > flags
Detected events all in one.