#include <userver/engine/io/fd_poller.hpp>
Low-level poller that can wait for read, write, and read/write operations on a file descriptor. It does not provide read/write operations.
Definition at line 32 of file fd_poller.hpp.
Public Types | |
enum class | Kind { kRead = 1 , kWrite = 2 , kReadWrite = 3 } |
Operation kind to wait for. More... | |
Public Member Functions | |
FdPoller (const ev::ThreadControl &control) | |
FdPoller (const FdPoller &)=delete | |
FdPoller (FdPoller &&)=delete | |
FdPoller & | operator= (const FdPoller &)=delete |
FdPoller & | operator= (FdPoller &&)=delete |
operator bool () const noexcept | |
The same as IsValid() . | |
bool | IsValid () const noexcept |
Whether the file descriptor is valid. | |
int | GetFd () const noexcept |
If IsValid(), get file descriptor. | |
void | Invalidate () |
void | Reset (int fd, Kind kind) |
std::optional< Kind > | Wait (Deadline) |
void | ResetReady () noexcept |
Reset "ready" flag for WaitAny(). | |
std::optional< FdPoller::Kind > | GetReady () noexcept |
|
strong |
Operation kind to wait for.
Enumerator | |
---|---|
kWrite | < wait for read availability |
kReadWrite | < wait for write availability |
Definition at line 35 of file fd_poller.hpp.
|
explicit |
|
noexcept |
Get event kind that was triggered on this poller. Resets "ready" flag.
void engine::io::FdPoller::Invalidate | ( | ) |
When you're done with fd, call Invalidate(). It unregisters the fd, after that you have to call close(2) by yourself. After Invalidate() you may not call Wait().
void engine::io::FdPoller::Reset | ( | int | fd, |
Kind | kind ) |