]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/detail/impl/posix_event.ipp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / detail / impl / posix_event.ipp
CommitLineData
7c673cae
FG
1//
2// detail/impl/posix_event.ipp
3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef BOOST_ASIO_DETAIL_IMPL_POSIX_EVENT_IPP
12#define BOOST_ASIO_DETAIL_IMPL_POSIX_EVENT_IPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19
20#if defined(BOOST_ASIO_HAS_PTHREADS)
21
22#include <boost/asio/detail/posix_event.hpp>
23#include <boost/asio/detail/throw_error.hpp>
24#include <boost/asio/error.hpp>
25
26#include <boost/asio/detail/push_options.hpp>
27
28namespace boost {
29namespace asio {
30namespace detail {
31
32posix_event::posix_event()
33 : state_(0)
34{
b32b8144
FG
35#if (defined(__MACH__) && defined(__APPLE__)) \
36 || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
7c673cae 37 int error = ::pthread_cond_init(&cond_, 0);
b32b8144
FG
38#else // (defined(__MACH__) && defined(__APPLE__))
39 // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
40 ::pthread_condattr_t attr;
1e59de90 41 int error = ::pthread_condattr_init(&attr);
b32b8144 42 if (error == 0)
1e59de90
TL
43 {
44 error = ::pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
45 if (error == 0)
46 error = ::pthread_cond_init(&cond_, &attr);
47 ::pthread_condattr_destroy(&attr);
48 }
b32b8144
FG
49#endif // (defined(__MACH__) && defined(__APPLE__))
50 // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
51
7c673cae
FG
52 boost::system::error_code ec(error,
53 boost::asio::error::get_system_category());
54 boost::asio::detail::throw_error(ec, "event");
55}
56
57} // namespace detail
58} // namespace asio
59} // namespace boost
60
61#include <boost/asio/detail/pop_options.hpp>
62
63#endif // defined(BOOST_ASIO_HAS_PTHREADS)
64
65#endif // BOOST_ASIO_DETAIL_IMPL_POSIX_EVENT_IPP