Skip to content

Commit

Permalink
Fix lock guads in PipePosix.cpp (#90572)
Browse files Browse the repository at this point in the history
Guard object destroyed immediately after creation without naming.
  • Loading branch information
dklimkin committed Apr 30, 2024
1 parent 74e65ee commit 29dda26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lldb/source/Host/posix/PipePosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Status PipePosix::CreateNew(bool child_processes_inherit) {
}

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

Expand Down Expand Up @@ -146,7 +146,7 @@ Status PipePosix::CreateWithUniqueName(llvm::StringRef prefix,

Status PipePosix::OpenAsReader(llvm::StringRef name,
bool child_process_inherit) {
std::scoped_lock<std::mutex, std::mutex> (m_read_mutex, m_write_mutex);
std::scoped_lock<std::mutex, std::mutex> guard(m_read_mutex, m_write_mutex);

if (CanReadUnlocked() || CanWriteUnlocked())
return Status("Pipe is already opened");
Expand Down

0 comments on commit 29dda26

Please sign in to comment.