[Lldb-commits] [PATCH] Make it possible to stop the operation thread in NativeProcessLinux

Tamas Berghammer tberghammer at google.com
Fri Feb 27 05:35:49 PST 2015


Hi vharron, ovyalov,

Make it possible to stop the operation thread in NativeProcessLinux

Previously the operation thread is stopped with a cancel event but pthread_cancel is not supported on android. This CL creates a custom operation which asks the operation thread to exit without any pthread call.

http://reviews.llvm.org/D7937

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -3369,6 +3369,14 @@
             assert(false && "Unexpected errno from sem_wait");
         }
 
+        // nullptr as operation means the operation thread should exit
+        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
@@ -3573,7 +3581,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.20846.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150227/544aa3f7/attachment.bin>


More information about the lldb-commits mailing list