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 void
51 HostThread::SetState(ThreadState state)
52 {
53     m_native_thread->SetState(state);
54 }
55 
56 ThreadState
57 HostThread::GetState() const
58 {
59     return m_native_thread->GetState();
60 }
61 
62 HostNativeThreadBase &
63 HostThread::GetNativeThread()
64 {
65     return *m_native_thread;
66 }
67 
68 const HostNativeThreadBase &
69 HostThread::GetNativeThread() const
70 {
71     return *m_native_thread;
72 }
73 
74 lldb::thread_result_t
75 HostThread::GetResult() const
76 {
77     return m_native_thread->GetResult();
78 }
79 
80 bool
81 HostThread::EqualsThread(lldb::thread_t thread) const
82 {
83     return m_native_thread->GetSystemHandle() == thread;
84 }
85