Fix up the HostThread interface, making the interface simpler.
Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5417
llvm-svn: 218325
diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
index 99d14d2..8f626be 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -1199,7 +1199,7 @@
// Finally, start monitoring the child process for change in state.
m_monitor_thread = Host::StartMonitoringChildProcess(
ProcessMonitor::MonitorCallback, this, GetPID(), true);
- if (m_monitor_thread.GetState() != eThreadStateRunning)
+ if (!m_monitor_thread.IsJoinable())
{
error.SetErrorToGenericError();
error.SetErrorString("Process launch failed.");
@@ -1250,7 +1250,7 @@
// Finally, start monitoring the child process for change in state.
m_monitor_thread = Host::StartMonitoringChildProcess(
ProcessMonitor::MonitorCallback, this, GetPID(), true);
- if (m_monitor_thread.GetState() != eThreadStateRunning)
+ if (!m_monitor_thread.IsJoinable())
{
error.SetErrorToGenericError();
error.SetErrorString("Process attach failed.");
@@ -1270,7 +1270,7 @@
{
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, LaunchOpThread, args, &error);
@@ -1493,7 +1493,7 @@
{
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);
@@ -2466,11 +2466,10 @@
void
ProcessMonitor::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();
}
}
@@ -2491,10 +2490,9 @@
void
ProcessMonitor::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();
}