]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/include/boost/fiber/detail/spinlock.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / detail / spinlock.hpp
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 // based on boost::interprocess::sync::interprocess_spin::mutex
8
9 #ifndef BOOST_FIBERS_SPINLOCK_H
10 #define BOOST_FIBERS_SPINLOCK_H
11
12 #include <mutex>
13
14 #include <boost/fiber/detail/config.hpp>
15
16 namespace boost {
17 namespace fibers {
18 namespace detail {
19
20 struct non_spinlock {
21 constexpr non_spinlock() noexcept {}
22 void lock() noexcept {}
23 void unlock() noexcept {}
24 };
25
26 struct non_lock {
27 constexpr non_lock( non_spinlock) noexcept {}
28 void lock() noexcept {}
29 void unlock() noexcept {}
30 };
31
32 #if ! defined(BOOST_FIBERS_NO_ATOMICS)
33 typedef std::mutex spinlock;
34 using spinlock_lock = std::unique_lock< spinlock >;
35 #else
36 typedef non_spinlock spinlock;
37 using spinlock_lock = non_lock;
38 #endif
39
40 }}}
41
42 #endif // BOOST_FIBERS_SPINLOCK_H