1 //===-- HostThread.cpp ------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Host/HostThread.h"
10 #include "lldb/Host/HostNativeThread.h"
13 using namespace lldb_private;
15 HostThread::HostThread() : m_native_thread(new HostNativeThread) {}
17 HostThread::HostThread(lldb::thread_t thread)
18 : m_native_thread(new HostNativeThread(thread)) {}
20 Status HostThread::Join(lldb::thread_result_t *result) {
21 return m_native_thread->Join(result);
24 Status HostThread::Cancel() { return m_native_thread->Cancel(); }
26 void HostThread::Reset() { return m_native_thread->Reset(); }
28 lldb::thread_t HostThread::Release() { return m_native_thread->Release(); }
30 bool HostThread::IsJoinable() const { return m_native_thread->IsJoinable(); }
32 HostNativeThread &HostThread::GetNativeThread() {
33 return static_cast<HostNativeThread &>(*m_native_thread);
36 const HostNativeThread &HostThread::GetNativeThread() const {
37 return static_cast<const HostNativeThread &>(*m_native_thread);
40 lldb::thread_result_t HostThread::GetResult() const {
41 return m_native_thread->GetResult();
44 bool HostThread::EqualsThread(lldb::thread_t thread) const {
45 return m_native_thread->EqualsThread(thread);