Skip to content

Commit 9d77a3f

Browse files
authored
[debugserver] Remove PThreadMutex (NFC) (#137555)
Now that all uses of PThreadMutex have been migrated to their C++ equivalent, this PR removes PThreadMutex itself.
1 parent a61048b commit 9d77a3f

File tree

10 files changed

+8
-206
lines changed

10 files changed

+8
-206
lines changed

lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
26CE05BA115C363E0022F371 /* DNBLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637E00C71334A0024798E /* DNBLog.cpp */; };
3737
26CE05BB115C363F0022F371 /* DNBRegisterInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637E20C71334A0024798E /* DNBRegisterInfo.cpp */; };
3838
26CE05BC115C36420022F371 /* PThreadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637FE0C71334A0024798E /* PThreadEvent.cpp */; };
39-
26CE05BD115C36430022F371 /* PThreadMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2672DBEE0EEF446700E92059 /* PThreadMutex.cpp */; };
4039
26CE05BE115C36440022F371 /* SysSignal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C638010C71334A0024798E /* SysSignal.cpp */; };
4140
26CE05BF115C364D0022F371 /* DNBArchImplX86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26CF99A21142EB7400011AAB /* DNBArchImplX86_64.cpp */; };
4241
26CE05C3115C36580022F371 /* CFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2695DD9B0D3EC160007E4CA2 /* CFString.cpp */; };
@@ -65,7 +64,6 @@
6564
456F67591AD46CE9002850C2 /* DNBLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637E00C71334A0024798E /* DNBLog.cpp */; };
6665
456F675A1AD46CE9002850C2 /* DNBRegisterInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637E20C71334A0024798E /* DNBRegisterInfo.cpp */; };
6766
456F675B1AD46CE9002850C2 /* PThreadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C637FE0C71334A0024798E /* PThreadEvent.cpp */; };
68-
456F675C1AD46CE9002850C2 /* PThreadMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2672DBEE0EEF446700E92059 /* PThreadMutex.cpp */; };
6967
456F675D1AD46CE9002850C2 /* SysSignal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C638010C71334A0024798E /* SysSignal.cpp */; };
7068
456F675E1AD46CE9002850C2 /* DNBArchImplX86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26CF99A21142EB7400011AAB /* DNBArchImplX86_64.cpp */; };
7169
456F67621AD46CE9002850C2 /* CFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2695DD9B0D3EC160007E4CA2 /* CFString.cpp */; };
@@ -102,7 +100,6 @@
102100
26593A060D4931CC001C9FE3 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
103101
266B5ECF1460A68200E43F0A /* DNBArchImplARM64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DNBArchImplARM64.cpp; sourceTree = "<group>"; };
104102
266B5ED01460A68200E43F0A /* DNBArchImplARM64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNBArchImplARM64.h; sourceTree = "<group>"; };
105-
2672DBEE0EEF446700E92059 /* PThreadMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PThreadMutex.cpp; sourceTree = "<group>"; };
106103
2695DD910D3EBFF6007E4CA2 /* CFBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CFBundle.cpp; sourceTree = "<group>"; };
107104
2695DD920D3EBFF6007E4CA2 /* CFBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFBundle.h; sourceTree = "<group>"; };
108105
2695DD9A0D3EC160007E4CA2 /* CFString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFString.h; sourceTree = "<group>"; };
@@ -151,7 +148,6 @@
151148
26C637FD0C71334A0024798E /* PThreadCondition.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PThreadCondition.h; sourceTree = "<group>"; };
152149
26C637FE0C71334A0024798E /* PThreadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PThreadEvent.cpp; sourceTree = "<group>"; };
153150
26C637FF0C71334A0024798E /* PThreadEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PThreadEvent.h; sourceTree = "<group>"; };
154-
26C638000C71334A0024798E /* PThreadMutex.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PThreadMutex.h; sourceTree = "<group>"; };
155151
26C638010C71334A0024798E /* SysSignal.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SysSignal.cpp; sourceTree = "<group>"; };
156152
26C638020C71334A0024798E /* SysSignal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SysSignal.h; sourceTree = "<group>"; };
157153
26C638050C71334A0024798E /* TTYState.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TTYState.cpp; sourceTree = "<group>"; };
@@ -284,8 +280,6 @@
284280
26C637FD0C71334A0024798E /* PThreadCondition.h */,
285281
26C637FF0C71334A0024798E /* PThreadEvent.h */,
286282
26C637FE0C71334A0024798E /* PThreadEvent.cpp */,
287-
26C638000C71334A0024798E /* PThreadMutex.h */,
288-
2672DBEE0EEF446700E92059 /* PThreadMutex.cpp */,
289283
233B4EA81D2DB96A00E98261 /* StringConvert.cpp */,
290284
26C638020C71334A0024798E /* SysSignal.h */,
291285
26C638010C71334A0024798E /* SysSignal.cpp */,
@@ -486,7 +480,6 @@
486480
26CE05BA115C363E0022F371 /* DNBLog.cpp in Sources */,
487481
26CE05BB115C363F0022F371 /* DNBRegisterInfo.cpp in Sources */,
488482
26CE05BC115C36420022F371 /* PThreadEvent.cpp in Sources */,
489-
26CE05BD115C36430022F371 /* PThreadMutex.cpp in Sources */,
490483
26CE05BE115C36440022F371 /* SysSignal.cpp in Sources */,
491484
26CE05BF115C364D0022F371 /* DNBArchImplX86_64.cpp in Sources */,
492485
26CE05C5115C36590022F371 /* CFBundle.cpp in Sources */,
@@ -525,7 +518,6 @@
525518
456F67591AD46CE9002850C2 /* DNBLog.cpp in Sources */,
526519
456F675A1AD46CE9002850C2 /* DNBRegisterInfo.cpp in Sources */,
527520
456F675B1AD46CE9002850C2 /* PThreadEvent.cpp in Sources */,
528-
456F675C1AD46CE9002850C2 /* PThreadMutex.cpp in Sources */,
529521
456F675D1AD46CE9002850C2 /* SysSignal.cpp in Sources */,
530522
456F675E1AD46CE9002850C2 /* DNBArchImplX86_64.cpp in Sources */,
531523
23043C9E1D35DBFA00FC25CA /* StringConvert.cpp in Sources */,

lldb/tools/debugserver/source/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ set(lldbDebugserverCommonSources
203203
libdebugserver.cpp
204204
PseudoTerminal.cpp
205205
PThreadEvent.cpp
206-
PThreadMutex.cpp
207206
RNBContext.cpp
208207
RNBRemote.cpp
209208
RNBServices.cpp

lldb/tools/debugserver/source/DNB.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <cstdlib>
1818
#include <libproc.h>
1919
#include <map>
20+
#include <mutex>
2021
#include <sys/resource.h>
2122
#include <sys/stat.h>
2223
#include <sys/sysctl.h>
@@ -69,8 +70,8 @@ static ProcessMap *GetProcessMap(bool can_create) {
6970
static ProcessMap *g_process_map_ptr = NULL;
7071

7172
if (can_create && g_process_map_ptr == NULL) {
72-
static pthread_mutex_t g_process_map_mutex = PTHREAD_MUTEX_INITIALIZER;
73-
PTHREAD_MUTEX_LOCKER(locker, &g_process_map_mutex);
73+
static std::mutex g_process_map_mutex;
74+
std::lock_guard<std::mutex> guard(g_process_map_mutex);
7475
if (g_process_map_ptr == NULL)
7576
g_process_map_ptr = new ProcessMap;
7677
}

lldb/tools/debugserver/source/DNBError.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "DNBError.h"
1414
#include "CFString.h"
1515
#include "DNBLog.h"
16-
#include "PThreadMutex.h"
1716

1817
#ifdef WITH_SPRINGBOARD
1918
#include <SpringBoardServices/SpringBoardServer.h>

lldb/tools/debugserver/source/DNBTimer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBTIMER_H
1515

1616
#include "DNBDefs.h"
17-
#include "PThreadMutex.h"
1817
#include <cstdint>
1918
#include <mutex>
2019
#include <sys/time.h>

lldb/tools/debugserver/source/MacOSX/MachException.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "DNBError.h"
1616
#include "DNBLog.h"
1717
#include "MachProcess.h"
18-
#include "PThreadMutex.h"
1918
#include "SysSignal.h"
2019
#include <cerrno>
2120
#include <inttypes.h>

lldb/tools/debugserver/source/MacOSX/MachException.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <vector>
1818

1919
class MachProcess;
20-
class PThreadMutex;
2120

2221
typedef union MachMessageTag {
2322
mach_msg_header_t hdr;

lldb/tools/debugserver/source/MacOSX/MachTask.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHTASK_H
1717
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHTASK_H
1818

19-
#include <mach/mach.h>
20-
#include <sys/socket.h>
21-
#include <map>
22-
#include <string>
2319
#include "DNBDefs.h"
24-
#include "RNBContext.h"
2520
#include "MachException.h"
2621
#include "MachVMMemory.h"
27-
#include "PThreadMutex.h"
22+
#include "RNBContext.h"
23+
#include <mach/mach.h>
24+
#include <map>
25+
#include <string>
26+
#include <sys/socket.h>
2827

2928
class MachProcess;
3029

lldb/tools/debugserver/source/PThreadMutex.cpp

Lines changed: 0 additions & 66 deletions
This file was deleted.

lldb/tools/debugserver/source/PThreadMutex.h

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)