summaryrefslogtreecommitdiff
path: root/boost/asio/detail/impl/posix_event.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/detail/impl/posix_event.ipp')
-rw-r--r--boost/asio/detail/impl/posix_event.ipp12
1 files changed, 12 insertions, 0 deletions
diff --git a/boost/asio/detail/impl/posix_event.ipp b/boost/asio/detail/impl/posix_event.ipp
index 3b465ca3cd..4ff246f301 100644
--- a/boost/asio/detail/impl/posix_event.ipp
+++ b/boost/asio/detail/impl/posix_event.ipp
@@ -32,7 +32,19 @@ namespace detail {
posix_event::posix_event()
: state_(0)
{
+#if (defined(__MACH__) && defined(__APPLE__)) \
+ || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
int error = ::pthread_cond_init(&cond_, 0);
+#else // (defined(__MACH__) && defined(__APPLE__))
+ // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
+ ::pthread_condattr_t attr;
+ ::pthread_condattr_init(&attr);
+ int error = ::pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
+ if (error == 0)
+ error = ::pthread_cond_init(&cond_, &attr);
+#endif // (defined(__MACH__) && defined(__APPLE__))
+ // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
+
boost::system::error_code ec(error,
boost::asio::error::get_system_category());
boost::asio::detail::throw_error(ec, "event");