![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
17 #ifndef ATHCONTAINERS_THREADING_H
18 #define ATHCONTAINERS_THREADING_H
21 #ifdef ATHCONTAINERS_NO_THREADS
39 class recursive_mutex {};
45 template <
class LOCKABLE>
50 lock_guard(LOCKABLE&) {}
63 void unlock_shared() {}
64 void lock_upgrade() {}
65 void unlock_upgrade() {}
66 void unlock_upgrade_and_lock() {}
70 upgrade_mutex& operator= (
const upgrade_mutex&);
78 class thread_specific_ptr
81 thread_specific_ptr() : m_ptr(0) {}
82 ~thread_specific_ptr() {
delete m_ptr; }
83 thread_specific_ptr (
const thread_specific_ptr&) =
delete;
84 thread_specific_ptr& operator= (
const thread_specific_ptr&) =
delete;
85 T*
get() {
return m_ptr; }
86 T* operator->() {
return m_ptr; }
88 const T*
get()
const {
return m_ptr; }
89 const T* operator->()
const {
return m_ptr; }
91 void reset (T* new_value=0) {
delete m_ptr; m_ptr = new_value; }
105 using concurrent_vector = std::vector<T>;
113 atomic() : m_val() {}
114 operator T()
const {
return m_val; }
115 atomic& operator= (
const T&
val) { m_val =
val;
return *
this; }
125 #else // not ATHCONTAINERS_NO_THREADS
129 #ifndef BOOST_SYSTEM_NO_DEPRECATED
130 #define BOOST_SYSTEM_NO_DEPRECATED 1
134 #include "boost/thread/shared_mutex.hpp"
135 #include "boost/thread/tss.hpp"
139 #if (__cplusplus > 201703L) && defined(__ROOTCLING__)
140 #pragma clang diagnostic push
141 #pragma clang diagnostic ignored "-Wdeprecated-volatile"
142 #endif // >C++17 with ROOT
143 #include "tbb/concurrent_vector.h"
144 #if (__cplusplus > 201703L) && defined(__ROOTCLING__)
145 #pragma clang diagnostic pop
146 #endif // >C++17 with ROOT
157 using boost::upgrade_mutex;
158 using boost::thread_specific_ptr;
161 using std::recursive_mutex;
162 using std::lock_guard;
166 using tbb::concurrent_vector;
184 #endif // not ATHCONTAINERS_NO_THREADS
197 template <
typename LOCKABLE>
246 template <
class LOCKABLE>
295 #endif // not ATHCONTAINERS_THREADING_H
void fence_acq_rel()
An acquire/release fence.
upgrading_lock(upgrading_lock const &)
~upgrading_lock()
Release the held lock.
strict_shared_lock(const lockable_type &obj)
Take out a shared lock on obj and remember it.
upgrading_lock(lockable_type &obj)
Take out an upgrade lock on obj and remember it.
strict_shared_lock(lockable_type &obj)
Take out a shared lock on obj and remember it.
strict_shared_lock(strict_shared_lock const &)
void fence_seq_cst()
A sequentially-consistent fence.
LOCKABLE lockable_type
The underlying object type.
SiLocalPosition operator*(const SiLocalPosition &position, const double factor)
Lock object for taking out shared locks.
void upgrade()
Convert the lock from upgrade to exclusive.
~strict_shared_lock()
Release the held lock.
upgrading_lock & operator=(upgrading_lock const &)
LOCKABLE lockable_type
The underlying object type.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
lockable_type & m_obj
The lock being held.
Lock object for taking out upgradable locks.
lockable_type & m_obj
The lock being held.
bool m_exclusive
Has the lock been converted to exclusive?
strict_shared_lock & operator=(strict_shared_lock const &)