|
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
36 class recursive_mutex {};
42 template <
class LOCKABLE>
47 lock_guard(LOCKABLE&) {}
60 void unlock_shared() {}
61 void lock_upgrade() {}
62 void unlock_upgrade() {}
63 void unlock_upgrade_and_lock() {}
67 upgrade_mutex& operator= (
const upgrade_mutex&);
75 class thread_specific_ptr
78 thread_specific_ptr() : m_ptr(0) {}
79 ~thread_specific_ptr() {
delete m_ptr; }
80 thread_specific_ptr (
const thread_specific_ptr&) =
delete;
81 thread_specific_ptr& operator= (
const thread_specific_ptr&) =
delete;
82 T*
get() {
return m_ptr; }
83 T* operator->() {
return m_ptr; }
85 const T*
get()
const {
return m_ptr; }
86 const T* operator->()
const {
return m_ptr; }
88 void reset (T* new_value=0) {
delete m_ptr; m_ptr = new_value; }
89 T*
release() {
T* ret = m_ptr; m_ptr = 0;
return ret; }
106 atomic() : m_val() {}
107 operator T()
const {
return m_val; }
108 atomic& operator= (
const T&
val) { m_val =
val;
return *
this; }
118 #else // not ATHCONTAINERS_NO_THREADS
122 #ifndef BOOST_SYSTEM_NO_DEPRECATED
123 #define BOOST_SYSTEM_NO_DEPRECATED 1
127 #include "boost/thread/shared_mutex.hpp"
128 #include "boost/thread/tss.hpp"
140 using boost::upgrade_mutex;
141 using boost::thread_specific_ptr;
144 using std::recursive_mutex;
145 using std::lock_guard;
165 #endif // not ATHCONTAINERS_NO_THREADS
178 template <
typename LOCKABLE>
227 template <
class LOCKABLE>
276 #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 &)