Epoll abstraction. More...
#include <senf/Scheduler/Poller.hh>
Public Types | |
enum | Events { EV_READ = EPOLLIN, EV_PRIO = EPOLLPRI, EV_WRITE = EPOLLOUT, EV_HUP = EPOLLHUP, EV_ERR = EPOLLERR } |
typedef Value | value_type |
typedef boost::transform_iterator< GetPollResult, epoll_event * > | iterator |
typedef boost::iterator_range< iterator > | range |
Public Member Functions | |
bool | set (int fd, int events, Value *data) |
Set file descriptor event data and mask. More... | |
void | remove (int fd) |
Remove file descriptor. More... | |
range | wait () |
Wait for one event. More... | |
void | timeout (int t) |
Set event timeout to t milliseconds. More... | |
int | timeout () const |
Current event timeout. More... | |
Structors and default members | |
Poller () | |
~Poller () | |
Epoll abstraction.
This class provides a more convenient interface to the epoll() API. File descriptors are registered with pointers to a parameterized event type. After waiting for an event, the Poller allows to iterate over the event instances for all posted events.
Value | Event type |
typedef boost::transform_iterator<GetPollResult, epoll_event*> senf::scheduler::detail::Poller< Value >::iterator |
typedef boost::iterator_range<iterator> senf::scheduler::detail::Poller< Value >::range |
typedef Value senf::scheduler::detail::Poller< Value >::value_type |
enum senf::scheduler::detail::Poller::Events |
senf::scheduler::detail::Poller< Value >::Poller | ( | ) |
senf::scheduler::detail::Poller< Value >::~Poller | ( | ) |
void senf::scheduler::detail::Poller< Value >::remove | ( | int | fd | ) |
Remove file descriptor.
bool senf::scheduler::detail::Poller< Value >::set | ( | int | fd, |
int | events, | ||
Value * | data | ||
) |
Set file descriptor event data and mask.
The Poller does not own data. The value is owned by some external entity (the dispatcher to be more precise).
void senf::scheduler::detail::Poller< Value >::timeout | ( | int | t | ) |
Set event timeout to t milliseconds.
int senf::scheduler::detail::Poller< Value >::timeout | ( | ) | const |
Current event timeout.
range senf::scheduler::detail::Poller< Value >::wait | ( | ) |
Wait for one event.