From acee96ae5290a965e20f1cb938002d9fd4012075 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 23 Sep 2014 18:32:09 +0000 Subject: Fix up the HostThread interface, making the interface simpler. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325 --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 6a397361d2a9..20ac736e424b 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1396,7 +1396,7 @@ WAIT_AGAIN: // Finally, start monitoring the child process for change in state. m_monitor_thread = Host::StartMonitoringChildProcess( NativeProcessLinux::MonitorCallback, this, GetID(), true); - if (m_monitor_thread.GetState() != eThreadStateRunning) + if (!m_monitor_thread.IsJoinable()) { error.SetErrorToGenericError(); error.SetErrorString ("Process attach failed to create monitor thread for NativeProcessLinux::MonitorCallback."); @@ -1474,7 +1474,7 @@ WAIT_AGAIN: // Finally, start monitoring the child process for change in state. m_monitor_thread = Host::StartMonitoringChildProcess ( NativeProcessLinux::MonitorCallback, this, GetID (), true); - if (m_monitor_thread.GetState() != eThreadStateRunning) + if (!m_monitor_thread.IsJoinable()) { error.SetErrorToGenericError (); error.SetErrorString ("Process attach failed to create monitor thread for NativeProcessLinux::MonitorCallback."); @@ -1495,7 +1495,7 @@ NativeProcessLinux::StartLaunchOpThread(LaunchArgs *args, Error &error) { static const char *g_thread_name = "lldb.process.nativelinux.operation"; - if (m_operation_thread.GetState() == eThreadStateRunning) + if (m_operation_thread.IsJoinable()) return; m_operation_thread = ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args, &error); @@ -1804,7 +1804,7 @@ NativeProcessLinux::StartAttachOpThread(AttachArgs *args, lldb_private::Error &e { static const char *g_thread_name = "lldb.process.linux.operation"; - if (m_operation_thread.GetState() == eThreadStateRunning) + if (m_operation_thread.IsJoinable()) return; m_operation_thread = ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args, &error); @@ -3645,11 +3645,10 @@ NativeProcessLinux::DupDescriptor(const char *path, int fd, int flags) void NativeProcessLinux::StopMonitoringChildProcess() { - if (m_monitor_thread.GetState() == eThreadStateRunning) + if (m_monitor_thread.IsJoinable()) { m_monitor_thread.Cancel(); m_monitor_thread.Join(nullptr); - m_monitor_thread.Reset(); } } @@ -3671,12 +3670,11 @@ NativeProcessLinux::StopMonitor() void NativeProcessLinux::StopOpThread() { - if (m_operation_thread.GetState() != eThreadStateRunning) + if (!m_operation_thread.IsJoinable()) return; m_operation_thread.Cancel(); m_operation_thread.Join(nullptr); - m_operation_thread.Reset(); } bool -- cgit v1.2.3