LLDB mainline
lldb_private::ProcessRunLock Class Reference

Read/write lock around the process running/stopped state. More...

#include "lldb/Host/ProcessRunLock.h"

Classes

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

Public Member Functions

 ProcessRunLock ()
 ~ProcessRunLock ()
bool SetRunning ()
 Set the process to running.
bool SetStopped ()
 Set the process to stopped.

Protected Attributes

lldb::rwlock_t m_rwlock
bool m_running = false

Private Member Functions

 ProcessRunLock (const ProcessRunLock &)=delete
const ProcessRunLockoperator= (const ProcessRunLock &)=delete
bool ReadTryLock ()
bool ReadUnlock ()

Private Attributes

std::mutex m_recursion_mutex
llvm::DenseMap< uint64_t, uint32_t > m_recursion

Friends

class ProcessRunLocker

Detailed Description

Read/write lock around the process running/stopped state.

POSIX rwlocks aren't reader-recursive: a thread holding the read lock can deadlock against a pending writer if it re-acquires directly. ProcessRunLocker tracks a per-thread recursion count so re-entry skips the rwlock; the raw primitives are private.

Definition at line 33 of file ProcessRunLock.h.

Constructor & Destructor Documentation

◆ ProcessRunLock() [1/2]

ProcessRunLock::ProcessRunLock ( )

◆ ~ProcessRunLock()

ProcessRunLock::~ProcessRunLock ( )

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

References m_rwlock.

◆ ProcessRunLock() [2/2]

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

References ProcessRunLock().

Member Function Documentation

◆ operator=()

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

References ProcessRunLock().

◆ ReadTryLock()

bool ProcessRunLock::ReadTryLock ( )
private

◆ ReadUnlock()

bool ProcessRunLock::ReadUnlock ( )
private

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

References m_rwlock.

◆ SetRunning()

bool ProcessRunLock::SetRunning ( )

Set the process to running.

Returns true if the process was stopped. Return false if the process was running.

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

References m_running, and m_rwlock.

◆ SetStopped()

bool ProcessRunLock::SetStopped ( )

Set the process to stopped.

Returns true if the process was running. Returns false if the process was stopped.

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

References m_running, and m_rwlock.

◆ ProcessRunLocker

friend class ProcessRunLocker
friend

Definition at line 88 of file ProcessRunLock.h.

Referenced by lldb_private::StoppedExecutionContext::AllowResume().

Member Data Documentation

◆ m_recursion

llvm::DenseMap<uint64_t, uint32_t> lldb_private::ProcessRunLock::m_recursion
private

◆ m_recursion_mutex

std::mutex lldb_private::ProcessRunLock::m_recursion_mutex
private

◆ m_running

bool lldb_private::ProcessRunLock::m_running = false
protected

Definition at line 80 of file ProcessRunLock.h.

Referenced by ReadTryLock(), SetRunning(), and SetStopped().

◆ m_rwlock

lldb::rwlock_t lldb_private::ProcessRunLock::m_rwlock
protected

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