Zth (libzth)
|
The poller to be used by a fiber. More...
#include <poller.h>
Public Types | |
typedef PollerClientBase | base |
typedef small_vector< Pollable * > | Result |
Result of poll(). More... | |
Public Types inherited from zth::PollerClientBase | |
typedef small_vector< Pollable * > | Result |
Result of poll(). More... | |
Public Member Functions | |
PollerClient () | |
PollerClient (std::initializer_list< std::reference_wrapper< Pollable >> l) | |
virtual | ~PollerClient () override |
virtual void | reserve (size_t more) override |
Reserve memory to add more pollables. More... | |
virtual int | add (Pollable &p) noexcept override |
Add a pollable object. More... | |
virtual int | remove (Pollable &p) noexcept override |
Remove a pollable object. More... | |
virtual Result const & | poll (int timeout_ms=-1) noexcept override |
Poll. More... | |
virtual void | event (Pollable &p) noexcept override |
Indicate that the given pollable got an event. More... | |
bool | empty () const noexcept final |
Checks if there is any pollable registered. More... | |
Public Member Functions inherited from zth::PollerClientBase | |
virtual | ~PollerClientBase () override=default |
Public Member Functions inherited from zth::PollerInterface | |
virtual | ~PollerInterface ()=default |
Dtor. More... | |
int | add (std::initializer_list< std::reference_wrapper< Pollable >> l) noexcept |
Add pollable objects. More... | |
Public Member Functions inherited from zth::UniqueID< PollerInterface > | |
UniqueID (UniqueID const &)=delete | |
UniqueID (UniqueID &&u) noexcept | |
UniqueID (string const &name) | |
UniqueID (string &&name) | |
UniqueID (char const *name=nullptr) | |
UniqueID & | operator= (UniqueID const &)=delete |
UniqueID & | operator= (UniqueID &&u) noexcept |
virtual | ~UniqueID ()=default |
void const * | normptr () const noexcept |
uint64_t | id () const noexcept |
string const & | name () const noexcept |
void | setName (string const &name) |
void | setName (char const *name) |
void | setName (string &&name) |
virtual char const * | id_str () const override |
Additional Inherited Members | |
Static Public Member Functions inherited from zth::UniqueID< PollerInterface > | |
static uint64_t | getID () noexcept |
Protected Member Functions inherited from zth::UniqueIDBase | |
virtual | ~UniqueIDBase ()=default |
The poller to be used by a fiber.
All poll requests are forwarded to the PollerServer, as managed by the current Worker's zth::Waiter.
zth::PollerClient::PollerClient | ( | ) |
Definition at line 215 of file poller.cpp.
zth::PollerClient::PollerClient | ( | std::initializer_list< std::reference_wrapper< Pollable >> | l | ) |
Definition at line 221 of file poller.cpp.
|
overridevirtualdefault |
|
overridevirtualnoexcept |
Add a pollable object.
Once a pollable is added, do not modify its properties, except for user_data
.
Implements zth::PollerInterface.
Definition at line 246 of file poller.cpp.
|
finalvirtualnoexcept |
Checks if there is any pollable registered.
Implements zth::PollerInterface.
Definition at line 346 of file poller.cpp.
|
overridevirtualnoexcept |
Indicate that the given pollable got an event.
Implements zth::PollerClientBase.
Definition at line 333 of file poller.cpp.
|
overridevirtualnoexcept |
Poll.
When timeout_ms
is -1, poll()
blocks until at least one of the pollables got an event. When timeout_ms
is 0, poll()
never blocks. Otherwise, poll()
blocks at most for timeout_ms
and return with a timeout, or return earlier when a pollable got an event.
errno
is set to the error. Implements zth::PollerClientBase.
Definition at line 272 of file poller.cpp.
|
overridevirtualnoexcept |
Remove a pollable object.
Implements zth::PollerInterface.
Definition at line 258 of file poller.cpp.
|
overridevirtual |
Reserve memory to add more pollables.
std::bad_alloc | when allocation fails |
Implements zth::PollerInterface.
Definition at line 240 of file poller.cpp.