|
LLDB mainline
|
A copyable RAII handle that pairs a pointer-like value with a shared (reader) lock on a caller-supplied mutex. More...
#include <Locked.h>
Public Types | |
| using | mutex_type = Mutex |
| using | lock_type = std::shared_lock<Mutex> |
Public Member Functions | |
| SharedLocked ()=default | |
| SharedLocked (mutex_type &m, PtrT p) | |
| SharedLocked (lock_type lock, PtrT p) | |
| SharedLocked (const SharedLocked &)=default | |
| SharedLocked & | operator= (const SharedLocked &)=default |
| SharedLocked (SharedLocked &&other) | |
| SharedLocked & | operator= (SharedLocked &&other) |
| Public Member Functions inherited from lldb_private::detail::LockedAccessors< SharedLocked< PtrT, llvm::sys::RWMutex >, PtrT > | |
| auto | operator-> () const |
| decltype(auto) | operator* () const |
| auto | get () const |
| operator bool () const | |
Private Attributes | |
| std::shared_ptr< lock_type > | m_lock |
| PtrT | m_ptr {} |
Static Private Attributes | |
| static constexpr bool | PointeeIsConst |
Friends | |
| class | detail::LockedAccessors< SharedLocked< PtrT, Mutex >, PtrT > |
A copyable RAII handle that pairs a pointer-like value with a shared (reader) lock on a caller-supplied mutex.
Copies share the same underlying reader lock through reference counting; the lock is released when the last copy is destroyed. This makes a SharedLocked cheap to pass through code paths that branch or fan out without each leaf having to re-acquire.
The borrowed pointer is const-qualified so callers cannot mutate the pointee while holding only a reader's lock. Mutex must satisfy SharedLockable — llvm::sys::RWMutex (the LLDB convention) or std::shared_mutex. Use the SharedLockedPtr, SharedLockedSP, SharedLockedUP aliases for the common combinations.
| using lldb_private::SharedLocked< PtrT, Mutex >::lock_type = std::shared_lock<Mutex> |
| using lldb_private::SharedLocked< PtrT, Mutex >::mutex_type = Mutex |
|
default |
|
inline |
|
inline |
|
default |
|
inline |
|
default |
|
inline |
|
friend |
|
private |
|
private |
|
staticconstexprprivate |