[Lldb-commits] [lldb] d4c3c28 - [lldb] Fix Process::SyncIOHandler

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 8 01:17:41 PDT 2023


Author: Pavel Labath
Date: 2023-09-08T10:17:16+02:00
New Revision: d4c3c2872ff6acd75ee3e0083fa62b2a1cc5310c

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

LOG: [lldb] Fix Process::SyncIOHandler

D157648 broke the function because it put the blocking wait into a
critical section. This meant that, if m_iohandler_sync was not updated
before entering the function, no amount of waiting would help.

Fix that by restriciting the scope of the critical section to the
iohandler check.

Added: 
    

Modified: 
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9555ff717859472..2b0774588138881 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -627,8 +627,7 @@ void Process::SyncIOHandler(uint32_t iohandler_id,
                             const Timeout<std::micro> &timeout) {
   // don't sync (potentially context switch) in case where there is no process
   // IO
-  std::lock_guard<std::mutex> guard(m_process_input_reader_mutex);
-  if (!m_process_input_reader)
+  if (!ProcessIOHandlerExists())
     return;
 
   auto Result = m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, timeout);


        


More information about the lldb-commits mailing list