8 #ifndef WPIUTIL_WPI_UV_POLL_H_
9 #define WPIUTIL_WPI_UV_POLL_H_
15 #include "wpi/Signal.h"
16 #include "wpi/uv/Handle.h"
27 struct private_init {};
30 explicit Poll(
const private_init&) {}
31 ~
Poll() noexcept
override =
default;
39 static std::shared_ptr<Poll>
Create(
Loop& loop,
int fd);
47 static std::shared_ptr<Poll>
Create(
const std::shared_ptr<Loop>& loop,
66 static std::shared_ptr<Poll>
CreateSocket(
const std::shared_ptr<Loop>& loop,
81 void Reuse(
int fd, std::function<
void()> callback);
93 void ReuseSocket(uv_os_sock_t sock, std::function<
void()> callback);
101 void Start(
int events);
115 std::function<void()> callback;
120 std::unique_ptr<ReuseData> m_reuseData;
126 #endif // WPIUTIL_WPI_UV_POLL_H_
uv_poll_t * GetRaw() const noexcept
Get the underlying handle data structure.
Definition: Handle.h:264
Handle.
Definition: Handle.h:249
static std::shared_ptr< Poll > CreateSocket(Loop &loop, uv_os_sock_t sock)
Create a poll handle using a socket descriptor.
void Stop()
Stop polling the file descriptor.
Definition: Poll.h:106
static std::shared_ptr< Poll > CreateSocket(const std::shared_ptr< Loop > &loop, uv_os_sock_t sock)
Create a poll handle using a socket descriptor.
Definition: Poll.h:66
static std::shared_ptr< Poll > Create(const std::shared_ptr< Loop > &loop, int fd)
Create a poll handle using a file descriptor.
Definition: Poll.h:47
Poll handle.
Definition: Poll.h:26
void ReuseSocket(uv_os_sock_t sock, std::function< void()> callback)
Reuse this handle.
WPILib C++ utilities (wpiutil) namespace.
Definition: SmallString.h:21
void Reuse(int fd, std::function< void()> callback)
Reuse this handle.
void Start(int events)
Start polling the file descriptor.
sig::Signal< int > pollEvent
Signal generated when a poll event occurs.
Definition: Poll.h:111
Event loop.
Definition: Loop.h:39
static std::shared_ptr< Poll > Create(Loop &loop, int fd)
Create a poll handle using a file descriptor.
SignalBase is an implementation of the observer pattern, through the use of an emitting object and sl...
Definition: Signal.h:495