[Lldb-commits] [PATCH] Make it possible to stop the operation	thread in NativeProcessLinux
    Tamas Berghammer 
    tberghammer at google.com
       
    Mon Mar  2 03:06:27 PST 2015
    
    
  
REPOSITORY
  rL LLVM
http://reviews.llvm.org/D7937
Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -3370,6 +3370,15 @@
             assert(false && "Unexpected errno from sem_wait");
         }
 
+        // nullptr as operation means the operation thread should exit. Cancel() can't be used
+        // because it is not supported on android.
+        if (!monitor->m_operation)
+        {
+            // notify calling thread that operation is complete
+            sem_post(&monitor->m_operation_done);
+            break;
+        }
+
         reinterpret_cast<Operation*>(monitor->m_operation)->Execute(monitor);
 
         // notify calling thread that operation is complete
@@ -3555,8 +3564,8 @@
 void
 NativeProcessLinux::StopMonitor()
 {
-    StopMonitoringChildProcess();
     StopOpThread();
+    StopMonitoringChildProcess();
     StopCoordinatorThread ();
     sem_destroy(&m_operation_pending);
     sem_destroy(&m_operation_done);
@@ -3574,7 +3583,7 @@
     if (!m_operation_thread.IsJoinable())
         return;
 
-    m_operation_thread.Cancel();
+    DoOperation(nullptr); // nullptr as operation ask the operation thread to exit
     m_operation_thread.Join(nullptr);
 }
EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7937.20993.patch
Type: text/x-patch
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150302/9065c04a/attachment.bin>
    
    
More information about the lldb-commits
mailing list