Skip to content

Commit 29dda26

Browse files
authored
Fix lock guads in PipePosix.cpp (#90572)
Guard object destroyed immediately after creation without naming.
1 parent 74e65ee commit 29dda26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Host/posix/PipePosix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Status PipePosix::CreateNew(bool child_processes_inherit) {
108108
}
109109

110110
Status PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit) {
111-
std::scoped_lock<std::mutex, std::mutex> (m_read_mutex, m_write_mutex);
111+
std::scoped_lock<std::mutex, std::mutex> guard(m_read_mutex, m_write_mutex);
112112
if (CanReadUnlocked() || CanWriteUnlocked())
113113
return Status("Pipe is already opened");
114114

@@ -146,7 +146,7 @@ Status PipePosix::CreateWithUniqueName(llvm::StringRef prefix,
146146

147147
Status PipePosix::OpenAsReader(llvm::StringRef name,
148148
bool child_process_inherit) {
149-
std::scoped_lock<std::mutex, std::mutex> (m_read_mutex, m_write_mutex);
149+
std::scoped_lock<std::mutex, std::mutex> guard(m_read_mutex, m_write_mutex);
150150

151151
if (CanReadUnlocked() || CanWriteUnlocked())
152152
return Status("Pipe is already opened");

0 commit comments

Comments
 (0)