/** \file
\brief Poller public header */
-#ifndef HH_Poller_
-#define HH_Poller_ 1
+#ifndef HH_SENF_Scheduler_Poller_
+#define HH_SENF_Scheduler_Poller_ 1
// Custom includes
#include <sys/epoll.h>
namespace senf {
namespace scheduler {
+namespace detail {
- /** \brief
+ /** \brief 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.
+
+ \tparam Value Event type
*/
template <class Value>
class Poller
enum Events {
EV_READ = EPOLLIN, EV_PRIO = EPOLLPRI, EV_WRITE = EPOLLOUT,
EV_HUP = EPOLLHUP, EV_ERR = EPOLLERR
-};
-
+ };
+
///////////////////////////////////////////////////////////////////////////
///\name Structors and default members
///@{
///@}
///////////////////////////////////////////////////////////////////////////
- bool set(int fd, int events, Value * data);
- void remove(int fd);
- range wait();
+ bool set(int fd, int events, Value * data); ///< Set file descriptor event data and mask
+ /**< The Poller does \e not own \a data. The value is owned
+ by some external entity (the dispatcher to be more
+ precise). */
+ void remove(int fd); ///< Remove file descriptor
+ range wait(); ///< Wait for one event
+ /**< \returns a range of iterators which iterate over the
+ data values registered with the event */
- void timeout(int t);
- int timeout() const;
+ void timeout(int t); ///< Set event timeout to \a t milliseconds
+ int timeout() const; ///< Current event timeout
private:
int epollFd_;
};
-}}
+}}}
///////////////////////////////hh.e////////////////////////////////////////
//#include "Poller.cci"