]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/detail/std_static_mutex.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / asio / detail / std_static_mutex.hpp
CommitLineData
7c673cae
FG
1//
2// detail/std_static_mutex.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4//
11fdf7f2 5// Copyright (c) 2003-2018 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_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
28namespace boost {
29namespace asio {
30namespace detail {
31
32class std_event;
33
34class std_static_mutex
35 : private noncopyable
36{
37public:
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
68private:
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