1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP
- #define BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP
- #include <boost/core/empty_value.hpp>
- #include <boost/histogram/detail/axes.hpp>
- #include <boost/mp11/utility.hpp>
- #include <mutex>
- namespace boost {
- namespace histogram {
- namespace detail {
- struct null_mutex {
- bool try_lock() noexcept { return true; }
- void lock() noexcept {}
- void unlock() noexcept {}
- };
- template <class Axes, class Storage,
- class DetailMutex = mp11::mp_if_c<(Storage::has_threading_support &&
- detail::has_growing_axis<Axes>::value),
- std::mutex, detail::null_mutex>>
- struct mutex_base : empty_value<DetailMutex> {
- mutex_base() = default;
-
- mutex_base(const mutex_base&) : empty_value<DetailMutex>() {}
-
- mutex_base& operator=(const mutex_base&) { return *this; }
- };
- }
- }
- }
- #endif
|