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