]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/detail/std_static_mutex.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / asio / detail / std_static_mutex.hpp
1 //
2 // detail/std_static_mutex.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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_STD_STATIC_MUTEX_HPP
12 #define BOOST_ASIO_DETAIL_STD_STATIC_MUTEX_HPP
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_STD_MUTEX_AND_CONDVAR)
21
22 #include <mutex>
23 #include <boost/asio/detail/noncopyable.hpp>
24 #include <boost/asio/detail/scoped_lock.hpp>
25
26 #include <boost/asio/detail/push_options.hpp>
27
28 namespace boost {
29 namespace asio {
30 namespace detail {
31
32 class std_event;
33
34 class std_static_mutex
35 : private noncopyable
36 {
37 public:
38 typedef boost::asio::detail::scoped_lock<std_static_mutex> scoped_lock;
39
40 // Constructor.
41 std_static_mutex(int)
42 {
43 }
44
45 // Destructor.
46 ~std_static_mutex()
47 {
48 }
49
50 // Initialise the mutex.
51 void init()
52 {
53 // Nothing to do.
54 }
55
56 // Lock the mutex.
57 void lock()
58 {
59 mutex_.lock();
60 }
61
62 // Unlock the mutex.
63 void unlock()
64 {
65 mutex_.unlock();
66 }
67
68 private:
69 friend class std_event;
70 std::mutex mutex_;
71 };
72
73 #define BOOST_ASIO_STD_STATIC_MUTEX_INIT 0
74
75 } // namespace detail
76 } // namespace asio
77 } // namespace boost
78
79 #include <boost/asio/detail/pop_options.hpp>
80
81 #endif // defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
82
83 #endif // BOOST_ASIO_DETAIL_STD_STATIC_MUTEX_HPP