From 7e4fa8505f479c494b9e7bab361e4a11e1c579a5 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:04:42 +0900 Subject: poller_base_t is used instead of poller_t Poller object is virtualised. You can access poller via its base class (poller_base_t) instead of using poller_t which was a typedef pointing to actual derived class. Signed-off-by: Martin Sustrik --- src/poller_base.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/poller_base.hpp') diff --git a/src/poller_base.hpp b/src/poller_base.hpp index 99a77b9..8d9ed16 100644 --- a/src/poller_base.hpp +++ b/src/poller_base.hpp @@ -23,6 +23,7 @@ #include +#include "fd.hpp" #include "clock.hpp" #include "atomic_counter.hpp" @@ -37,13 +38,24 @@ namespace xs { public: - poller_base_t (); + // Create optimal poller mechanism for this environment. + static poller_base_t *create (); + virtual ~poller_base_t (); // Returns load of the poller. Note that this function can be // invoked from a different thread! int get_load (); + virtual handle_t add_fd (fd_t fd_, xs::i_poll_events *events_) = 0; + virtual void rm_fd (handle_t handle_) = 0; + virtual void set_pollin (handle_t handle_) = 0; + virtual void reset_pollin (handle_t handle_) = 0; + virtual void set_pollout (handle_t handle_) = 0; + virtual void reset_pollout (handle_t handle_) = 0; + virtual void start () = 0; + virtual void stop () = 0; + // Add a timeout to expire in timeout_ milliseconds. After the // expiration timer_event on sink_ object will be called with // argument set to id_. @@ -54,6 +66,8 @@ namespace xs protected: + poller_base_t (); + // Called by individual poller implementations to manage the load. void adjust_load (int amount_); -- cgit v1.2.3