diff options
author | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
commit | 205afe679855a4ce8149cdaa94d3f0868ce796dc (patch) | |
tree | 09bc83f73246ee3c7a779605cd0122093d2a8a19 /source/Core/Communication.cpp | |
parent | 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff) |
Diffstat (limited to 'source/Core/Communication.cpp')
-rw-r--r-- | source/Core/Communication.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/source/Core/Communication.cpp b/source/Core/Communication.cpp index d71c9881a6f3..ea84843fe0b3 100644 --- a/source/Core/Communication.cpp +++ b/source/Core/Communication.cpp @@ -18,6 +18,8 @@ #include "lldb/Core/Timer.h" #include "lldb/Core/Event.h" #include "lldb/Host/Host.h" +#include "lldb/Host/HostThread.h" +#include "lldb/Host/ThreadLauncher.h" #include <string.h> using namespace lldb; @@ -36,7 +38,6 @@ Communication::GetStaticBroadcasterClass () Communication::Communication(const char *name) : Broadcaster (NULL, name), m_connection_sp (), - m_read_thread (LLDB_INVALID_HOST_THREAD), m_read_thread_enabled (false), m_bytes(), m_bytes_mutex (Mutex::eMutexTypeRecursive), @@ -232,7 +233,7 @@ Communication::StartReadThread (Error *error_ptr) if (error_ptr) error_ptr->Clear(); - if (IS_VALID_LLDB_HOST_THREAD(m_read_thread)) + if (m_read_thread.IsJoinable()) return true; lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION, @@ -243,8 +244,8 @@ Communication::StartReadThread (Error *error_ptr) snprintf(thread_name, sizeof(thread_name), "<lldb.comm.%s>", m_broadcaster_name.AsCString()); m_read_thread_enabled = true; - m_read_thread = Host::ThreadCreate (thread_name, Communication::ReadThread, this, error_ptr); - if (!IS_VALID_LLDB_HOST_THREAD(m_read_thread)) + m_read_thread = ThreadLauncher::LaunchThread(thread_name, Communication::ReadThread, this, error_ptr); + if (!m_read_thread.IsJoinable()) m_read_thread_enabled = false; return m_read_thread_enabled; } @@ -252,7 +253,7 @@ Communication::StartReadThread (Error *error_ptr) bool Communication::StopReadThread (Error *error_ptr) { - if (!IS_VALID_LLDB_HOST_THREAD(m_read_thread)) + if (!m_read_thread.IsJoinable()) return true; lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION, @@ -262,22 +263,20 @@ Communication::StopReadThread (Error *error_ptr) BroadcastEvent (eBroadcastBitReadThreadShouldExit, NULL); - //Host::ThreadCancel (m_read_thread, error_ptr); + // error = m_read_thread.Cancel(); - bool status = Host::ThreadJoin (m_read_thread, NULL, error_ptr); - m_read_thread = LLDB_INVALID_HOST_THREAD; - return status; + Error error = m_read_thread.Join(nullptr); + return error.Success(); } bool Communication::JoinReadThread (Error *error_ptr) { - if (!IS_VALID_LLDB_HOST_THREAD(m_read_thread)) + if (!m_read_thread.IsJoinable()) return true; - bool success = Host::ThreadJoin (m_read_thread, NULL, error_ptr); - m_read_thread = LLDB_INVALID_HOST_THREAD; - return success; + Error error = m_read_thread.Join(nullptr); + return error.Success(); } size_t |