diff options
| author | Tamas Berghammer <tberghammer@google.com> | 2015-03-02 11:04:03 +0000 |
|---|---|---|
| committer | Tamas Berghammer <tberghammer@google.com> | 2015-03-02 11:04:03 +0000 |
| commit | 6806fded8cf6cb9e323eacde28fc5bd91d92415a (patch) | |
| tree | 1a0431945f8ff3d1642be8fcbbd084ca448a631e /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | |
| parent | f1115fe0c5f367b55119b129a4b0c219ae8d3c31 (diff) | |
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.
Differential revision: http://reviews.llvm.org/D7937
llvm-svn: 230945
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index fad5d708f963..abb002ec0a4e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -3370,6 +3370,15 @@ NativeProcessLinux::ServeOperation(OperationArgs *args) 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 @@ NativeProcessLinux::StopMonitoringChildProcess() void NativeProcessLinux::StopMonitor() { - StopMonitoringChildProcess(); StopOpThread(); + StopMonitoringChildProcess(); StopCoordinatorThread (); sem_destroy(&m_operation_pending); sem_destroy(&m_operation_done); @@ -3574,7 +3583,7 @@ NativeProcessLinux::StopOpThread() 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); } |
