]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fiber/include/boost/fiber/mutex.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / mutex.hpp
CommitLineData
7c673cae
FG
1
2// Copyright Oliver Kowalke 2013.
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#ifndef BOOST_FIBERS_MUTEX_H
8#define BOOST_FIBERS_MUTEX_H
9
10#include <boost/config.hpp>
11
12#include <boost/assert.hpp>
13
14#include <boost/fiber/context.hpp>
15#include <boost/fiber/detail/config.hpp>
16#include <boost/fiber/detail/spinlock.hpp>
17
18#ifdef BOOST_HAS_ABI_HEADERS
19# include BOOST_ABI_PREFIX
20#endif
21
22#ifdef _MSC_VER
23# pragma warning(push)
24# pragma warning(disable:4251)
25#endif
26
27namespace boost {
28namespace fibers {
29
30class condition_variable;
31
32class BOOST_FIBERS_DECL mutex {
33private:
34 friend class condition_variable;
35
36 typedef context::wait_queue_t wait_queue_t;
37
38 context * owner_{ nullptr };
39 wait_queue_t wait_queue_{};
40 detail::spinlock wait_queue_splk_{};
41
42public:
43 mutex() = default;
44
45 ~mutex() {
46 BOOST_ASSERT( nullptr == owner_);
47 BOOST_ASSERT( wait_queue_.empty() );
48 }
49
50 mutex( mutex const&) = delete;
51 mutex & operator=( mutex const&) = delete;
52
53 void lock();
54
55 bool try_lock();
56
57 void unlock();
58};
59
60}}
61
62#ifdef _MSC_VER
63# pragma warning(pop)
64#endif
65
66#ifdef BOOST_HAS_ABI_HEADERS
67# include BOOST_ABI_SUFFIX
68#endif
69
70#endif // BOOST_FIBERS_MUTEX_H