diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:04:34 +0900 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:04:34 +0900 |
commit | c918272cc9eb3555d259e22dc587ee01e1c74324 (patch) | |
tree | f9b74a454a3066e26b62fcd5df5a89ac267940b1 | |
parent | 35797d6c69032fc9eaa472c501b7fbba8e388026 (diff) |
Simplify mechanism for choosing polling mechanism
Till now the selection process was implemented both
in autotools build system and in the code itself.
From now on, it's exclusively build system's taks to
choose the right polling mechanism.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | acinclude.m4 | 2 | ||||
-rw-r--r-- | src/devpoll.cpp | 3 | ||||
-rw-r--r-- | src/devpoll.hpp | 6 | ||||
-rw-r--r-- | src/epoll.cpp | 3 | ||||
-rw-r--r-- | src/epoll.hpp | 6 | ||||
-rw-r--r-- | src/kqueue.cpp | 3 | ||||
-rw-r--r-- | src/kqueue.hpp | 5 | ||||
-rw-r--r-- | src/poll.cpp | 3 | ||||
-rw-r--r-- | src/poll.hpp | 6 | ||||
-rw-r--r-- | src/poller.hpp | 54 | ||||
-rw-r--r-- | src/select.cpp | 3 | ||||
-rw-r--r-- | src/select.hpp | 6 |
12 files changed, 29 insertions, 71 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 1d08392..0c7b1e0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -767,7 +767,7 @@ AC_DEFUN([LIBXS_CHECK_POLLER], [{ ;; esac - libxs_cv_poller_flag=`echo "XS_FORCE_${libxs_cv_poller}" | tr a-z A-Z` + libxs_cv_poller_flag=`echo "XS_HAVE_${libxs_cv_poller}" | tr a-z A-Z` AS_IF([test "x${libxs_cv_poller}" != "x"], [AC_MSG_RESULT([using $libxs_cv_poller]) ; $1], [AC_MSG_RESULT(no suitable polling system found) ; $2]) diff --git a/src/devpoll.cpp b/src/devpoll.cpp index 2d96f26..e6c8007 100644 --- a/src/devpoll.cpp +++ b/src/devpoll.cpp @@ -20,7 +20,8 @@ */ #include "devpoll.hpp" -#if defined XS_USE_DEVPOLL + +#if defined XS_HAVE_DEVPOLL #include <sys/devpoll.h> #include <sys/time.h> diff --git a/src/devpoll.hpp b/src/devpoll.hpp index 069eb4c..8015f62 100644 --- a/src/devpoll.hpp +++ b/src/devpoll.hpp @@ -22,9 +22,9 @@ #ifndef __XS_DEVPOLL_HPP_INCLUDED__ #define __XS_DEVPOLL_HPP_INCLUDED__ -// poller.hpp decides which polling mechanism to use. -#include "poller.hpp" -#if defined XS_USE_DEVPOLL +#include "platform.hpp" + +#if defined XS_HAVE_DEVPOLL #include <vector> diff --git a/src/epoll.cpp b/src/epoll.cpp index 83d9b77..37e47d3 100644 --- a/src/epoll.cpp +++ b/src/epoll.cpp @@ -20,7 +20,8 @@ */ #include "epoll.hpp" -#if defined XS_USE_EPOLL + +#if defined XS_HAVE_EPOLL #include <sys/epoll.h> #include <stdlib.h> diff --git a/src/epoll.hpp b/src/epoll.hpp index ed33254..3745c77 100644 --- a/src/epoll.hpp +++ b/src/epoll.hpp @@ -22,9 +22,9 @@ #ifndef __XS_EPOLL_HPP_INCLUDED__ #define __XS_EPOLL_HPP_INCLUDED__ -// poller.hpp decides which polling mechanism to use. -#include "poller.hpp" -#if defined XS_USE_EPOLL +#include "platform.hpp" + +#if defined XS_HAVE_EPOLL #include <vector> #include <sys/epoll.h> diff --git a/src/kqueue.cpp b/src/kqueue.cpp index 54c31d8..495a194 100644 --- a/src/kqueue.cpp +++ b/src/kqueue.cpp @@ -20,7 +20,8 @@ */ #include "kqueue.hpp" -#if defined XS_USE_KQUEUE + +#if defined XS_HAVE_KQUEUE #include <sys/time.h> #include <sys/types.h> diff --git a/src/kqueue.hpp b/src/kqueue.hpp index 71cf3e7..02388c1 100644 --- a/src/kqueue.hpp +++ b/src/kqueue.hpp @@ -22,9 +22,8 @@ #ifndef __XS_KQUEUE_HPP_INCLUDED__ #define __XS_KQUEUE_HPP_INCLUDED__ -// poller.hpp decides which polling mechanism to use. -#include "poller.hpp" -#if defined XS_USE_KQUEUE +#include "platform.hpp" +#if defined XS_HAVE_KQUEUE #include <vector> diff --git a/src/poll.cpp b/src/poll.cpp index 7a55379..2677bb0 100644 --- a/src/poll.cpp +++ b/src/poll.cpp @@ -20,7 +20,8 @@ */ #include "poll.hpp" -#if defined XS_USE_POLL + +#if defined XS_HAVE_POLL #include <sys/types.h> #include <sys/time.h> diff --git a/src/poll.hpp b/src/poll.hpp index 28bb2eb..cdeb75b 100644 --- a/src/poll.hpp +++ b/src/poll.hpp @@ -22,9 +22,9 @@ #ifndef __XS_POLL_HPP_INCLUDED__ #define __XS_POLL_HPP_INCLUDED__ -// poller.hpp decides which polling mechanism to use. -#include "poller.hpp" -#if defined XS_USE_POLL +#include "platform.hpp" + +#if defined XS_HAVE_POLL #include <poll.h> #include <stddef.h> diff --git a/src/poller.hpp b/src/poller.hpp index bf3c38f..eff2e5e 100644 --- a/src/poller.hpp +++ b/src/poller.hpp @@ -22,61 +22,15 @@ #ifndef __XS_POLLER_HPP_INCLUDED__ #define __XS_POLLER_HPP_INCLUDED__ -#include "platform.hpp" +namespace xs +{ + typedef void* handle_t; +} -#if defined XS_FORCE_SELECT -#define XS_USE_SELECT -#include "select.hpp" -#elif defined XS_FORCE_POLL -#define XS_USE_POLL -#include "poll.hpp" -#elif defined XS_FORCE_EPOLL -#define XS_USE_EPOLL -#include "epoll.hpp" -#elif defined XS_FORCE_DEVPOLL -#define XS_USE_DEVPOLL #include "devpoll.hpp" -#elif defined XS_FORCE_KQUEUE -#define XS_USE_KQUEUE -#include "kqueue.hpp" -#elif defined XS_HAVE_LINUX -#define XS_USE_EPOLL #include "epoll.hpp" -#elif defined XS_HAVE_WINDOWS -#define XS_USE_SELECT -#include "select.hpp" -#elif defined XS_HAVE_FREEBSD -#define XS_USE_KQUEUE -#include "kqueue.hpp" -#elif defined XS_HAVE_OPENBSD -#define XS_USE_KQUEUE -#include "kqueue.hpp" -#elif defined XS_HAVE_NETBSD -#define XS_USE_KQUEUE #include "kqueue.hpp" -#elif defined XS_HAVE_SOLARIS -#define XS_USE_DEVPOLL -#include "devpoll.hpp" -#elif defined XS_HAVE_OSX -#define XS_USE_KQUEUE -#include "kqueue.hpp" -#elif defined XS_HAVE_QNXNTO -#define XS_USE_POLL -#include "poll.hpp" -#elif defined XS_HAVE_AIX -#define XS_USE_POLL #include "poll.hpp" -#elif defined XS_HAVE_HPUX -#define XS_USE_DEVPOLL -#include "devpoll.hpp" -#elif defined XS_HAVE_OPENVMS -#define XS_USE_SELECT -#include "select.hpp" -#elif defined XS_HAVE_CYGWIN -#define XS_USE_SELECT #include "select.hpp" -#else -#error Unsupported platform -#endif #endif diff --git a/src/select.cpp b/src/select.cpp index 7f05817..49b4e74 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -20,7 +20,8 @@ */ #include "select.hpp" -#if defined XS_USE_SELECT + +#if defined XS_HAVE_SELECT #include "platform.hpp" #if defined XS_HAVE_WINDOWS diff --git a/src/select.hpp b/src/select.hpp index f3f6c48..3686507 100644 --- a/src/select.hpp +++ b/src/select.hpp @@ -22,9 +22,9 @@ #ifndef __XS_SELECT_HPP_INCLUDED__ #define __XS_SELECT_HPP_INCLUDED__ -// poller.hpp decides which polling mechanism to use. -#include "poller.hpp" -#if defined XS_USE_SELECT +#include "platform.hpp" + +#if defined XS_HAVE_SELECT #include "platform.hpp" |