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.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/poller_base.cpp') diff --git a/src/poller_base.cpp b/src/poller_base.cpp index 7c8ddfd..5fe3a4f 100644 --- a/src/poller_base.cpp +++ b/src/poller_base.cpp @@ -22,6 +22,30 @@ #include "i_poll_events.hpp" #include "err.hpp" +#include "select.hpp" +#include "poll.hpp" +#include "epoll.hpp" +#include "devpoll.hpp" +#include "kqueue.hpp" + +xs::poller_base_t *xs::poller_base_t::create () +{ + poller_base_t *result; +#if defined XS_HAVE_SELECT + result = new (std::nothrow) select_t; +#elif defined XS_HAVE_POLL + result = new (std::nothrow) poll_t; +#elif defined XS_HAVE_EPOLL + result = new (std::nothrow) epoll_t; +#elif defined XS_HAVE_DEVPOLL + result = new (std::nothrow) devpoll_t; +#elif defined XS_HAVE_KQUEUE + result = new (std::nothrow) kqueue_t; +#endif + alloc_assert (result); + return result; +} + xs::poller_base_t::poller_base_t () { } -- cgit v1.2.3