1 // Copyright 2019 Hans Dembinski
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP
8 #define BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP
10 #include <boost/core/empty_value.hpp>
11 #include <boost/histogram/detail/axes.hpp>
12 #include <boost/mp11/utility.hpp> // mp_if
20 bool try_lock() noexcept { return true; }
21 void lock() noexcept {}
22 void unlock() noexcept {}
25 template <class Axes, class Storage,
26 class DetailMutex = mp11::mp_if_c<(Storage::has_threading_support &&
27 detail::has_growing_axis<Axes>::value),
28 std::mutex, detail::null_mutex>>
29 struct mutex_base : empty_value<DetailMutex> {
30 mutex_base() = default;
31 // do not copy or move mutex
32 mutex_base(const mutex_base&) : empty_value<DetailMutex>() {}
33 // do not copy or move mutex
34 mutex_base& operator=(const mutex_base&) { return *this; }
38 } // namespace histogram