diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:09:54 +0900 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:09:54 +0900 |
commit | 0641ffa5e9588dd7daaf389c40a213994fe4b1b1 (patch) | |
tree | ba0152291d8a0aa01f6a531021fe4927c214b41f | |
parent | 5391d09c9801ec7680f5dba430131c4f8d079765 (diff) |
Intercept start() and stop() calls in poller_base_t
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/devpoll.cpp | 4 | ||||
-rw-r--r-- | src/devpoll.hpp | 4 | ||||
-rw-r--r-- | src/epoll.cpp | 6 | ||||
-rw-r--r-- | src/epoll.hpp | 4 | ||||
-rw-r--r-- | src/kqueue.cpp | 4 | ||||
-rw-r--r-- | src/kqueue.hpp | 4 | ||||
-rw-r--r-- | src/poll.cpp | 4 | ||||
-rw-r--r-- | src/poll.hpp | 4 | ||||
-rw-r--r-- | src/poller_base.cpp | 10 | ||||
-rw-r--r-- | src/poller_base.hpp | 7 | ||||
-rw-r--r-- | src/select.cpp | 4 | ||||
-rw-r--r-- | src/select.hpp | 4 |
12 files changed, 36 insertions, 23 deletions
diff --git a/src/devpoll.cpp b/src/devpoll.cpp index 4cf4d6a..899e1b8 100644 --- a/src/devpoll.cpp +++ b/src/devpoll.cpp @@ -125,12 +125,12 @@ void xs::devpoll_t::reset_pollout (handle_t handle_) devpoll_ctl (handle_, fd_table [handle_].events); } -void xs::devpoll_t::start () +void xs::devpoll_t::xstart () { worker.start (worker_routine, this); } -void xs::devpoll_t::stop () +void xs::devpoll_t::xstop () { stopping = true; } diff --git a/src/devpoll.hpp b/src/devpoll.hpp index 761152c..a6ae5e4 100644 --- a/src/devpoll.hpp +++ b/src/devpoll.hpp @@ -53,8 +53,8 @@ namespace xs void reset_pollin (handle_t handle_); void set_pollout (handle_t handle_); void reset_pollout (handle_t handle_); - void start (); - void stop (); + void xstart (); + void xstop (); private: diff --git a/src/epoll.cpp b/src/epoll.cpp index 0ab5d19..7208a57 100644 --- a/src/epoll.cpp +++ b/src/epoll.cpp @@ -31,8 +31,8 @@ #include <new> #include "epoll.hpp" -#include "err.hpp" #include "config.hpp" +#include "err.hpp" xs::epoll_t::epoll_t () : stopping (false) @@ -118,12 +118,12 @@ void xs::epoll_t::reset_pollout (handle_t handle_) errno_assert (rc != -1); } -void xs::epoll_t::start () +void xs::epoll_t::xstart () { worker.start (worker_routine, this); } -void xs::epoll_t::stop () +void xs::epoll_t::xstop () { stopping = true; } diff --git a/src/epoll.hpp b/src/epoll.hpp index e90c7e3..bac555b 100644 --- a/src/epoll.hpp +++ b/src/epoll.hpp @@ -55,8 +55,8 @@ namespace xs void reset_pollin (handle_t handle_); void set_pollout (handle_t handle_); void reset_pollout (handle_t handle_); - void start (); - void stop (); + void xstart (); + void xstop (); private: diff --git a/src/kqueue.cpp b/src/kqueue.cpp index 154e498..982bb43 100644 --- a/src/kqueue.cpp +++ b/src/kqueue.cpp @@ -141,12 +141,12 @@ void xs::kqueue_t::reset_pollout (handle_t handle_) } } -void xs::kqueue_t::start () +void xs::kqueue_t::xstart () { worker.start (worker_routine, this); } -void xs::kqueue_t::stop () +void xs::kqueue_t::xstop () { stopping = true; } diff --git a/src/kqueue.hpp b/src/kqueue.hpp index 436dadd..676396e 100644 --- a/src/kqueue.hpp +++ b/src/kqueue.hpp @@ -53,8 +53,8 @@ namespace xs void reset_pollin (handle_t handle_); void set_pollout (handle_t handle_); void reset_pollout (handle_t handle_); - void start (); - void stop (); + void xstart (); + void xstop (); private: diff --git a/src/poll.cpp b/src/poll.cpp index ab17ccd..4796cdb 100644 --- a/src/poll.cpp +++ b/src/poll.cpp @@ -106,12 +106,12 @@ void xs::poll_t::reset_pollout (handle_t handle_) pollset [index].events &= ~((short) POLLOUT); } -void xs::poll_t::start () +void xs::poll_t::xstart () { worker.start (worker_routine, this); } -void xs::poll_t::stop () +void xs::poll_t::xstop () { stopping = true; } diff --git a/src/poll.hpp b/src/poll.hpp index 7b9b024..535a3b2 100644 --- a/src/poll.hpp +++ b/src/poll.hpp @@ -56,8 +56,8 @@ namespace xs void reset_pollin (handle_t handle_); void set_pollout (handle_t handle_); void reset_pollout (handle_t handle_); - void start (); - void stop (); + void xstart (); + void xstop (); private: diff --git a/src/poller_base.cpp b/src/poller_base.cpp index 8bf091e..83e0301 100644 --- a/src/poller_base.cpp +++ b/src/poller_base.cpp @@ -55,6 +55,16 @@ xs::poller_base_t::~poller_base_t () xs_assert (get_load () == 0); } +void xs::poller_base_t::start () +{ + xstart (); +} + +void xs::poller_base_t::stop () +{ + xstop (); +} + int xs::poller_base_t::get_load () { return load.get (); diff --git a/src/poller_base.hpp b/src/poller_base.hpp index 5edb5d4..e63f203 100644 --- a/src/poller_base.hpp +++ b/src/poller_base.hpp @@ -63,14 +63,17 @@ namespace xs // invoked from a different thread! int get_load (); + void start (); + void stop (); + 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; + virtual void xstart () = 0; + virtual void xstop () = 0; // Add a timeout to expire in timeout_ milliseconds. After the // expiration timer_event on sink_ object will be called. diff --git a/src/select.cpp b/src/select.cpp index 65772c7..3518c52 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -138,12 +138,12 @@ void xs::select_t::reset_pollout (handle_t handle_) FD_CLR (ptrtofd (handle_), &source_set_out); } -void xs::select_t::start () +void xs::select_t::xstart () { worker.start (worker_routine, this); } -void xs::select_t::stop () +void xs::select_t::xstop () { stopping = true; } diff --git a/src/select.hpp b/src/select.hpp index 5279402..93ab77f 100644 --- a/src/select.hpp +++ b/src/select.hpp @@ -66,8 +66,8 @@ namespace xs void reset_pollin (handle_t handle_); void set_pollout (handle_t handle_); void reset_pollout (handle_t handle_); - void start (); - void stop (); + void xstart (); + void xstop (); private: |