LLDB mainline
lldb_private::ProcessRunLock::ProcessRunLocker Class Reference

RAII helper around the read-lock side of ProcessRunLock. More...

#include <ProcessRunLock.h>

Public Member Functions

 ProcessRunLocker ()=default
 ProcessRunLocker (ProcessRunLocker &&other)
ProcessRunLockeroperator= (ProcessRunLocker &&other)
 ~ProcessRunLocker ()
bool IsLocked () const
bool TryLock (ProcessRunLock *lock)
 Try to acquire the read lock.

Protected Member Functions

void Unlock ()

Protected Attributes

ProcessRunLockm_lock = nullptr
uint64_t m_thread = 0

Private Member Functions

 ProcessRunLocker (const ProcessRunLocker &)=delete
const ProcessRunLockeroperator= (const ProcessRunLocker &)=delete

Detailed Description

RAII helper around the read-lock side of ProcessRunLock.

Supports same-thread recursion (see class doc).

Move-assignment unlocks the destination first, then takes the source's lock. Cross-thread move of a held locker is fatal — the same thread that called rdlock must call unlock.

Definition at line 52 of file ProcessRunLock.h.

Constructor & Destructor Documentation

◆ ProcessRunLocker() [1/3]

lldb_private::ProcessRunLock::ProcessRunLocker::ProcessRunLocker ( )
default

◆ ProcessRunLocker() [2/3]

lldb_private::ProcessRunLock::ProcessRunLocker::ProcessRunLocker ( ProcessRunLocker && other)

Definition at line 63 of file common/ProcessRunLock.cpp.

References m_lock, m_thread, and ProcessRunLocker().

◆ ~ProcessRunLocker()

lldb_private::ProcessRunLock::ProcessRunLocker::~ProcessRunLocker ( )
inline

Definition at line 57 of file ProcessRunLock.h.

References Unlock().

◆ ProcessRunLocker() [3/3]

lldb_private::ProcessRunLock::ProcessRunLocker::ProcessRunLocker ( const ProcessRunLocker & )
privatedelete

References ProcessRunLocker().

Member Function Documentation

◆ IsLocked()

bool lldb_private::ProcessRunLock::ProcessRunLocker::IsLocked ( ) const
inline

Definition at line 59 of file ProcessRunLock.h.

References m_lock.

◆ operator=() [1/2]

const ProcessRunLocker & lldb_private::ProcessRunLock::ProcessRunLocker::operator= ( const ProcessRunLocker & )
privatedelete

References ProcessRunLocker().

◆ operator=() [2/2]

ProcessRunLock::ProcessRunLocker & lldb_private::ProcessRunLock::ProcessRunLocker::operator= ( ProcessRunLocker && other)

Definition at line 74 of file common/ProcessRunLock.cpp.

References m_lock, m_thread, ProcessRunLocker(), and Unlock().

◆ TryLock()

bool lldb_private::ProcessRunLock::ProcessRunLocker::TryLock ( ProcessRunLock * lock)

Try to acquire the read lock.

If this thread already holds the read lock on this ProcessRunLock, the underlying rwlock is bypassed and the per-instance recursion count for this thread is bumped instead.

Definition at line 87 of file common/ProcessRunLock.cpp.

References m_lock, lldb_private::ProcessRunLock::m_recursion, lldb_private::ProcessRunLock::m_recursion_mutex, m_thread, lldb_private::ProcessRunLock::ProcessRunLock(), lldb_private::ProcessRunLock::ReadTryLock(), and Unlock().

Referenced by lldb::SBProcess::AllocateMemory(), lldb::SBProcess::DeallocateMemory(), lldb::SBTarget::EvaluateExpression(), lldb_private::QueueImpl::FetchItems(), lldb_private::QueueImpl::FetchThreads(), lldb::SBProcess::FindInMemory(), lldb::SBProcess::FindRangesInMemory(), lldb::SBQueueItem::GetExtendedBacktraceThread(), lldb::SBProcess::GetMemoryRegionInfo(), lldb::SBProcess::GetMemoryRegions(), lldb::SBProcess::GetNumQueues(), lldb::SBProcess::GetNumThreads(), lldb::SBProcess::GetQueueAtIndex(), lldb_private::ValueImpl::GetSP(), lldb_private::GetStoppedExecutionContext(), lldb::SBProcess::GetThreadAtIndex(), lldb::SBProcess::GetThreadByID(), lldb::SBProcess::GetThreadByIndexID(), lldb::SBProcess::LoadImage(), lldb::SBProcess::LoadImageUsingPaths(), lldb::SBProcess::ReadCStringFromMemory(), lldb::SBProcess::ReadMemory(), lldb::SBProcess::ReadPointerFromMemory(), lldb::SBProcess::ReadUnsignedFromMemory(), lldb::SBProcess::SendEventData(), lldb_private::ExecutionContextRef::SetProcessPtr(), lldb_private::ExecutionContextRef::SetThreadPtr(), lldb::SBProcess::UnloadImage(), and lldb::SBProcess::WriteMemory().

◆ Unlock()

void lldb_private::ProcessRunLock::ProcessRunLocker::Unlock ( )
protected

Definition at line 123 of file common/ProcessRunLock.cpp.

References m_lock, and m_thread.

Referenced by operator=(), TryLock(), and ~ProcessRunLocker().

Member Data Documentation

◆ m_lock

ProcessRunLock* lldb_private::ProcessRunLock::ProcessRunLocker::m_lock = nullptr
protected

Definition at line 70 of file ProcessRunLock.h.

Referenced by IsLocked(), operator=(), ProcessRunLocker(), TryLock(), and Unlock().

◆ m_thread

uint64_t lldb_private::ProcessRunLock::ProcessRunLocker::m_thread = 0
protected

Definition at line 71 of file ProcessRunLock.h.

Referenced by operator=(), ProcessRunLocker(), TryLock(), and Unlock().


The documentation for this class was generated from the following files: