Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lldb/tools/debugserver/source/MacOSX/MachThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ MachThread::MachThread(MachProcess *process, bool is_64_bit,
uint64_t unique_thread_id, thread_t mach_port_num)
: m_process(process), m_unique_id(unique_thread_id),
m_mach_port_number(mach_port_num), m_seq_id(GetSequenceID()),
m_state(eStateUnloaded), m_state_mutex(PTHREAD_MUTEX_RECURSIVE),
m_suspend_count(0), m_stop_exception(),
m_arch_up(DNBArchProtocol::Create(this)), m_reg_sets(NULL),
m_num_reg_sets(0), m_extended_info(), m_dispatch_queue_name(),
m_is_64_bit(is_64_bit), m_pthread_qos_class_decode(nullptr) {
m_state(eStateUnloaded), m_state_mutex(), m_suspend_count(0),
m_stop_exception(), m_arch_up(DNBArchProtocol::Create(this)),
m_reg_sets(NULL), m_num_reg_sets(0), m_extended_info(),
m_dispatch_queue_name(), m_is_64_bit(is_64_bit),
m_pthread_qos_class_decode(nullptr) {
nub_size_t num_reg_sets = 0;
m_reg_sets = m_arch_up->GetRegisterSetInfo(&num_reg_sets);
m_num_reg_sets = num_reg_sets;
Expand Down Expand Up @@ -469,13 +469,12 @@ bool MachThread::NotifyException(MachException::Data &exc) {
}

nub_state_t MachThread::GetState() {
// If any other threads access this we will need a mutex for it
PTHREAD_MUTEX_LOCKER(locker, m_state_mutex);
std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
return m_state;
}

void MachThread::SetState(nub_state_t state) {
PTHREAD_MUTEX_LOCKER(locker, m_state_mutex);
std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
m_state = state;
DNBLogThreadedIf(LOG_THREAD,
"MachThread::SetState ( %s ) for tid = 0x%8.8" PRIx64 "",
Expand Down
4 changes: 1 addition & 3 deletions lldb/tools/debugserver/source/MacOSX/MachThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "DNBArch.h"
#include "DNBRegisterInfo.h"
#include "MachException.h"
#include "PThreadCondition.h"
#include "PThreadMutex.h"

#include "ThreadInfo.h"

Expand Down Expand Up @@ -139,7 +137,7 @@ class MachThread {
// namesp.
uint32_t m_seq_id; // A Sequential ID that increments with each new thread
nub_state_t m_state; // The state of our process
PThreadMutex m_state_mutex; // Multithreaded protection for m_state
std::recursive_mutex m_state_mutex; // Multithreaded protection for m_state
struct thread_basic_info m_basic_info; // Basic information for a thread used
// to see if a thread is valid
int32_t m_suspend_count; // The current suspend count > 0 means we have
Expand Down
Loading