Low-level poller that can wait for read, write, and read/write operations on a file descriptor. It does not provide read/write operations.
More...
#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.
- Note
- FdPoller is not thread safe and its methods must not be called from multiple threads simultaneously.
Definition at line 24 of file fd_poller.hpp.
◆ Kind
Operation kind to wait for.
Enumerator |
---|
kWrite | < wait for read availability
|
kReadWrite | < wait for write availability
|
Definition at line 27 of file fd_poller.hpp.
◆ Invalidate()
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().
◆ Reset()
void engine::io::FdPoller::Reset |
( |
int |
fd, |
|
|
Kind |
kind |
|
) |
| |
Setup fd and kind to wait for. After Reset() you may call Wait(). FdPoller does not take the ownership of fd
, you still have to close fd
when you're done.
◆ Wait()
std::optional< Kind > engine::io::FdPoller::Wait |
( |
Deadline |
| ) |
|
Wait for an event kind that was passed in the latest Reset() call. If the operation (read/write) can already be handled, Wait() returns immediately. You have to call Reset() at least once before call to Wait().
The documentation for this class was generated from the following file: