summaryrefslogtreecommitdiff
path: root/src/polling.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/polling.hpp')
-rw-r--r--src/polling.hpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/polling.hpp b/src/polling.hpp
new file mode 100644
index 0000000..b8f0540
--- /dev/null
+++ b/src/polling.hpp
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2012 250bpm s.r.o.
+ Copyright (c) 2012 Other contributors as noted in the AUTHORS file
+
+ This file is part of Crossroads I/O project.
+
+ Crossroads I/O is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Crossroads is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __XS_CORE_HPP_INCLUDED__
+#define __XS_CORE_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+// This header file contains code that decides what polling mechanisms
+// should be used in individual cases. It also includes appropriate headers.
+//
+// ASYNC polling mechanism to drive event loops in the I/O threads.
+// SYNC polling mechanism is used in xs_poll() and for blocking API functions.
+
+#if defined XS_FORCE_SELECT
+#define XS_USE_ASYNC_SELECT
+#elif defined XS_FORCE_POLL
+#define XS_USE_ASYNC_POLL
+#elif defined XS_FORCE_EPOLL
+#define XS_USE_ASYNC_EPOLL
+#elif defined XS_FORCE_DEVPOLL
+#define XS_USE_ASYNC_DEVPOLL
+#elif defined XS_FORCE_KQUEUE
+#define XS_USE_ASYNC_KQUEUE
+#elif defined XS_HAVE_EPOLL
+#define XS_USE_ASYNC_EPOLL
+#elif defined XS_HAVE_DEVPOLL
+#define XS_USE_ASYNC_DEVPOLL
+#elif defined XS_HAVE_KQUEUE
+#define XS_USE_ASYNC_KQUEUE
+#elif defined XS_HAVE_POLL
+#define XS_USE_ASYNC_POLL
+#elif defined XS_HAVE_SELECT
+#define XS_USE_ASYNC_SELECT
+#else
+#error No polling mechanism available!
+#endif
+
+#if defined XS_FORCE_SELECT
+#define XS_USE_SYNC_SELECT
+#elif defined XS_FORCE_POLL
+#define XS_USE_SYNC_POLL
+#elif defined XS_HAVE_POLL
+#define XS_USE_SYNC_POLL
+#elif defined XS_HAVE_SELECT
+#define XS_USE_SYNC_SELECT
+#else
+#error No polling mechanism available!
+#endif
+
+#endif