Commit 715ade35 authored by Dominik Charousset's avatar Dominik Charousset

fixed selection of poll/epoll impl, closes #110

this patch also gets rid of an unused-private-field-warning
when compiling w/o context switching
parent 04f3b8fa
cmake_minimum_required(VERSION 2.8)
project(cppa CXX)
project(cppa C CXX)
set(LIBCPPA_VERSION_MAJOR 0)
set(LIBCPPA_VERSION_MINOR 8)
......@@ -84,14 +84,6 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif ("${CMAKE_BUILD_TYPE}" STREQUAL "")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LIBCPPA_PLATFORM_SRC src/middleman_event_handler_epoll.cpp)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LIBCPPA_PLATFORM_SRC src/middleman_event_handler_poll.cpp)
else ()
message(FATAL_ERROR "This platform is not supported by libcppa")
endif()
set(LIBCPPA_SRC
${LIBCPPA_PLATFORM_SRC}
src/abstract_tuple.cpp
......@@ -143,6 +135,8 @@ set(LIBCPPA_SRC
src/message_header.cpp
src/middleman.cpp
src/middleman_event_handler.cpp
src/middleman_event_handler_epoll.cpp
src/middleman_event_handler_poll.cpp
src/object.cpp
src/object_array.cpp
src/on.cpp
......
......@@ -31,10 +31,6 @@
#ifndef CPPA_CONFIG_HPP
#define CPPA_CONFIG_HPP
// uncomment this line or use define CPPA_DISABLE_CONTEXT_SWITCHING using CMAKE
// if boost.context is not available on your platform
//#define CPPA_DISABLE_CONTEXT_SWITCHING
#if defined(__clang__)
# define CPPA_CLANG
# define CPPA_DEPRECATED __attribute__((__deprecated__))
......@@ -54,6 +50,10 @@
# endif
#elif defined(__linux__)
# define CPPA_LINUX
# include <linux/version.h>
# if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
# define CPPA_POLL_IMPL
# endif
#elif defined(WIN32)
# define CPPA_WINDOWS
#else
......@@ -80,7 +80,7 @@
CPPA_REQUIRE__(#stmt, __FILE__, __LINE__); \
}((void) 0)
#else // CPPA_DEBUG_MODE
#define CPPA_REQUIRE(unused) ((void) 0)
#define CPPA_REQUIRE(unused) static_cast<void>(0)
#endif // CPPA_DEBUG_MODE
#define CPPA_CRITICAL__(error, file, line) { \
......@@ -93,11 +93,6 @@
#ifdef CPPA_WINDOWS
#else
# include <unistd.h>
# include <linux/version.h>
# if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
# define CPPA_POLL_IMPL
# endif // LINUX_VERSION
#endif
namespace cppa {
......@@ -110,7 +105,6 @@ std::unique_ptr<T> create_unique(Args&&... args) {
return std::unique_ptr<T>{new T(std::forward<Args>(args)...)};
}
#ifdef CPPA_WINDOWS
typedef SOCKET native_socket_type;
typedef const char* socket_send_ptr;
......
......@@ -50,7 +50,7 @@
namespace cppa {
class scheduler;
namespace util { class fiber; }
namespace util { struct fiber; }
enum class resume_result {
actor_blocked,
......
......@@ -35,9 +35,7 @@ namespace cppa { namespace util {
class fiber_impl;
class fiber {
public:
struct fiber {
fiber();
......@@ -47,8 +45,6 @@ class fiber {
static void swap(fiber& from, fiber& to);
private:
fiber_impl* m_impl;
};
......
......@@ -108,8 +108,8 @@ class middleman_impl {
atomic_thread_fence(memory_order_seq_cst);
uint8_t dummy = 0;
// ignore result; write error only means middleman already exited
auto unused_ret = write(m_pipe_write, &dummy, sizeof(dummy));
static_cast<void>(unused_ret);
auto unused_ret = write(m_pipe_write, &dummy, sizeof(dummy));
static_cast<void>(unused_ret);
}
void continue_writer(continuable* ptr) {
......
......@@ -27,6 +27,11 @@
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#include "cppa/config.hpp"
#if defined(CPPA_LINUX) && !defined(CPPA_POLL_IMPL)
#include <ios>
#include <string>
#include <vector>
......@@ -171,4 +176,10 @@ std::unique_ptr<middleman_event_handler> middleman_event_handler::create() {
return std::unique_ptr<middleman_event_handler>{new middleman_event_handler_impl};
}
} } // namespace cppa::network
} } // namespace cppa::io
#else // defined(CPPA_LINUX) && !defined(CPPA_POLL_IMPL)
int keep_compiler_happy_for_epoll_impl() { return 42; }
#endif // defined(CPPA_LINUX) && !defined(CPPA_POLL_IMPL)
......@@ -28,6 +28,10 @@
\******************************************************************************/
#include "cppa/config.hpp"
#if !defined(CPPA_LINUX) || defined(CPPA_POLL_IMPL)
#include <poll.h>
#include "cppa/io/middleman_event_handler.hpp"
......@@ -154,4 +158,10 @@ std::unique_ptr<middleman_event_handler> middleman_event_handler::create() {
return std::unique_ptr<middleman_event_handler>{new middleman_event_handler_impl};
}
} } // namespace cppa::network
} } // namespace cppa::io
#else // !defined(CPPA_LINUX) || defined(CPPA_POLL_IMPL)
int keep_compiler_happy_for_poll_impl() { return 42; }
#endif // !defined(CPPA_LINUX) || defined(CPPA_POLL_IMPL)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment