1 //===-- HostThreadPosix.cpp -----------------------------------------------===//
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/posix/HostThreadPosix.h"
10 #include "lldb/Utility/Status.h"
16 using namespace lldb_private
;
18 HostThreadPosix::HostThreadPosix() = default;
20 HostThreadPosix::HostThreadPosix(lldb::thread_t thread
)
21 : HostNativeThreadBase(thread
) {}
23 HostThreadPosix::~HostThreadPosix() = default;
25 Status
HostThreadPosix::Join(lldb::thread_result_t
*result
) {
28 int err
= ::pthread_join(m_thread
, result
);
29 error
.SetError(err
, lldb::eErrorTypePOSIX
);
33 error
.SetError(EINVAL
, eErrorTypePOSIX
);
40 Status
HostThreadPosix::Cancel() {
44 llvm_unreachable("someone is calling HostThread::Cancel()");
46 int err
= ::pthread_cancel(m_thread
);
47 error
.SetError(err
, eErrorTypePOSIX
);
53 Status
HostThreadPosix::Detach() {
56 int err
= ::pthread_detach(m_thread
);
57 error
.SetError(err
, eErrorTypePOSIX
);