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/HostNativeThread.h" 11 #include "lldb/Host/HostThread.h" 12 13 using namespace lldb; 14 using namespace lldb_private; 15 16 HostThread::HostThread() 17 : m_native_thread(new HostNativeThread) 18 { 19 } 20 21 HostThread::HostThread(lldb::thread_t thread) 22 : m_native_thread(new HostNativeThread(thread)) 23 { 24 } 25 26 Error 27 HostThread::Join(lldb::thread_result_t *result) 28 { 29 return m_native_thread->Join(result); 30 } 31 32 Error 33 HostThread::Cancel() 34 { 35 return m_native_thread->Cancel(); 36 } 37 38 void 39 HostThread::Reset() 40 { 41 return m_native_thread->Reset(); 42 } 43 44 lldb::thread_t 45 HostThread::Release() 46 { 47 return m_native_thread->Release(); 48 } 49 50 bool 51 HostThread::IsJoinable() const 52 { 53 return m_native_thread->IsJoinable(); 54 } 55 56 HostNativeThread & 57 HostThread::GetNativeThread() 58 { 59 return static_cast<HostNativeThread &>(*m_native_thread); 60 } 61 62 const HostNativeThread & 63 HostThread::GetNativeThread() const 64 { 65 return static_cast<const HostNativeThread &>(*m_native_thread); 66 } 67 68 lldb::thread_result_t 69 HostThread::GetResult() const 70 { 71 return m_native_thread->GetResult(); 72 } 73 74 bool 75 HostThread::EqualsThread(lldb::thread_t thread) const 76 { 77 return m_native_thread->GetSystemHandle() == thread; 78 } 79