1 //===-- HostThread.cpp ------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Host/HostThread.h" 11 #include "lldb/Host/HostNativeThread.h" 12 13 using namespace lldb; 14 using namespace lldb_private; 15 16 HostThread::HostThread() : m_native_thread(new HostNativeThread) {} 17 18 HostThread::HostThread(lldb::thread_t thread) 19 : m_native_thread(new HostNativeThread(thread)) {} 20 21 Error HostThread::Join(lldb::thread_result_t *result) { 22 return m_native_thread->Join(result); 23 } 24 25 Error HostThread::Cancel() { return m_native_thread->Cancel(); } 26 27 void HostThread::Reset() { return m_native_thread->Reset(); } 28 29 lldb::thread_t HostThread::Release() { return m_native_thread->Release(); } 30 31 bool HostThread::IsJoinable() const { return m_native_thread->IsJoinable(); } 32 33 HostNativeThread &HostThread::GetNativeThread() { 34 return static_cast<HostNativeThread &>(*m_native_thread); 35 } 36 37 const HostNativeThread &HostThread::GetNativeThread() const { 38 return static_cast<const HostNativeThread &>(*m_native_thread); 39 } 40 41 lldb::thread_result_t HostThread::GetResult() const { 42 return m_native_thread->GetResult(); 43 } 44 45 bool HostThread::EqualsThread(lldb::thread_t thread) const { 46 return m_native_thread->GetSystemHandle() == thread; 47 } 48