diff options
author | Zachary Turner <zturner@google.com> | 2014-09-23 18:32:09 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-09-23 18:32:09 +0000 |
commit | acee96ae5290a965e20f1cb938002d9fd4012075 (patch) | |
tree | 090ef226cafe984b57d38731f777c760cacc8fde /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | 4364fef82f06ebffd6dda0802a0b22126ae52c77 (diff) | |
download | bcm5719-llvm-acee96ae5290a965e20f1cb938002d9fd4012075.tar.gz bcm5719-llvm-acee96ae5290a965e20f1cb938002d9fd4012075.zip |
Fix up the HostThread interface, making the interface simpler.
Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5417
llvm-svn: 218325
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 28708be5ccb..4a78f6dd189 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1432,7 +1432,7 @@ ProcessGDBRemote::DoResume () TimeValue timeout; timeout = TimeValue::Now(); timeout.OffsetWithSeconds (5); - if (m_async_thread.GetState() != eThreadStateRunning) + if (!m_async_thread.IsJoinable()) { error.SetErrorString ("Trying to resume but the async thread is dead."); if (log) @@ -2891,22 +2891,17 @@ ProcessGDBRemote::StartAsyncThread () log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); Mutex::Locker start_locker(m_async_thread_state_mutex); - if (m_async_thread.GetState() != eThreadStateRunning) + if (!m_async_thread.IsJoinable()) { // Create a thread that watches our internal state and controls which // events make it to clients (into the DCProcess event queue). m_async_thread = ThreadLauncher::LaunchThread("<lldb.process.gdb-remote.async>", ProcessGDBRemote::AsyncThread, this, NULL); } - else - { - // Somebody tried to start the async thread while it was either being started or stopped. If the former, and - // it started up successfully, then say all's well. Otherwise it is an error, since we aren't going to restart it. - if (log) - log->Printf("ProcessGDBRemote::%s () - Called when Async thread was in state: %d.", __FUNCTION__, m_async_thread.GetState()); - } + else if (log) + log->Printf("ProcessGDBRemote::%s () - Called when Async thread was already running.", __FUNCTION__); - return (m_async_thread.GetState() == eThreadStateRunning); + return m_async_thread.IsJoinable(); } void @@ -2918,7 +2913,7 @@ ProcessGDBRemote::StopAsyncThread () log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); Mutex::Locker start_locker(m_async_thread_state_mutex); - if (m_async_thread.GetState() == eThreadStateRunning) + if (m_async_thread.IsJoinable()) { m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncThreadShouldExit); @@ -2928,11 +2923,8 @@ ProcessGDBRemote::StopAsyncThread () // Stop the stdio thread m_async_thread.Join(nullptr); } - else - { - if (log) - log->Printf("ProcessGDBRemote::%s () - Called when Async thread was in state: %d.", __FUNCTION__, m_async_thread.GetState()); - } + else if (log) + log->Printf("ProcessGDBRemote::%s () - Called when Async thread was not running.", __FUNCTION__); } |