[Lldb-commits] [lldb] 29dda26 - Fix lock guads in PipePosix.cpp (#90572)

via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 30 01:06:32 PDT 2024


Author: Danial Klimkin
Date: 2024-04-30T10:06:28+02:00
New Revision: 29dda26c65fc50066792f558e95f9603a7d7effc

URL: https://github.com/llvm/llvm-project/commit/29dda26c65fc50066792f558e95f9603a7d7effc
DIFF: https://github.com/llvm/llvm-project/commit/29dda26c65fc50066792f558e95f9603a7d7effc.diff

LOG: Fix lock guads in PipePosix.cpp (#90572)

Guard object destroyed immediately after creation without naming.

Added: 
    

Modified: 
    lldb/source/Host/posix/PipePosix.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp
index afd3fe39059ac1..f35c348990df62 100644
--- a/lldb/source/Host/posix/PipePosix.cpp
+++ b/lldb/source/Host/posix/PipePosix.cpp
@@ -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");
 
@@ -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");


        


More information about the lldb-commits mailing list