Commit f48167fa authored by Dominik Charousset's avatar Dominik Charousset

Add defines for iOS and Android

parent 5e55e81a
......@@ -131,16 +131,23 @@
// - CAF_WINDOWS
// It also defines CAF_POSIX for POSIX-compatible systems
#if defined(__APPLE__)
# define CAF_MACOS
# ifndef _GLIBCXX_HAS_GTHREADS
# define _GLIBCXX_HAS_GTHREADS
# include "TargetConditionals.h"
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
# define CAF_IOS
# else
# define CAF_MACOS
# ifndef _GLIBCXX_HAS_GTHREADS
# define _GLIBCXX_HAS_GTHREADS
# endif
# endif
#elif defined(__ANDROID__)
# define CAF_ANDROID
#elif defined(__linux__)
# define CAF_LINUX
# include <linux/version.h>
# if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
# define CAF_POLL_IMPL
# endif
# include <linux/version.h>
# if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
# define CAF_POLL_IMPL
# endif
#elif defined(__FreeBSD__)
# define CAF_BSD
#elif defined(WIN32) || defined(_WIN32)
......
......@@ -22,7 +22,7 @@
#include "caf/config.hpp"
#ifdef CAF_MACOS
#if defined(CAF_MACOS) || defined(CAF_IOS)
#include <mach/mach.h>
#else
#include <sys/resource.h>
......@@ -58,7 +58,7 @@ class profiled_coordinator : public coordinator<Policy> {
class measurement {
public:
# ifdef CAF_MACOS
# if defined(CAF_MACOS) || defined(CAF_IOS)
static usec to_usec(const ::time_value_t& tv) {
return std::chrono::seconds(tv.seconds) + usec(tv.microseconds);
}
......@@ -72,7 +72,7 @@ class profiled_coordinator : public coordinator<Policy> {
auto now = clock_type::now().time_since_epoch();
measurement m;
m.time = std::chrono::duration_cast<usec>(now);
# ifdef CAF_MACOS
# if defined(CAF_MACOS) || defined(CAF_IOS)
auto tself = ::mach_thread_self();
::thread_basic_info info;
auto count = THREAD_BASIC_INFO_COUNT;
......
#include "caf/config.hpp"
#include "caf/detail/get_mac_addresses.hpp"
#if defined(CAF_MACOS) || defined(CAF_BSD)
#if defined(CAF_MACOS) || defined(CAF_BSD) || defined(CAF_IOS)
#include <sys/types.h>
#include <sys/socket.h>
......@@ -76,7 +76,7 @@ std::vector<iface_info> get_mac_addresses() {
} // namespace detail
} // namespace caf
#elif defined(CAF_LINUX)
#elif defined(CAF_LINUX) || defined(CAF_ANDROID)
#include <vector>
#include <string>
......
......@@ -50,11 +50,11 @@ using std::string;
namespace {
#ifdef CAF_MACOS
#if defined(CAF_MACOS) || defined(CAF_IOS)
constexpr int no_sigpipe_flag = SO_NOSIGPIPE;
#elif defined(CAF_WINDOWS)
constexpr int no_sigpipe_flag = 0; // does not exist on Windows
#else // BSD or Linux
#else // BSD, Linux or Android
constexpr int no_sigpipe_flag = MSG_NOSIGNAL;
#endif
......
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