LLDB mainline
HostThreadWindows.cpp
Go to the documentation of this file.
1//===-- HostThreadWindows.cpp ---------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
10
13
14#include "llvm/ADT/STLExtras.h"
15
16using namespace lldb;
17using namespace lldb_private;
18
19static void __stdcall ExitThreadProxy(ULONG_PTR dwExitCode) {
20 ::ExitThread(dwExitCode);
21}
22
25
28
30
32
34 if (!IsJoinable())
35 return Status(ERROR_INVALID_HANDLE, eErrorTypeWin32);
36
38 DWORD wait_result = ::WaitForSingleObject(m_thread, INFINITE);
39 if (wait_result == WAIT_OBJECT_0) {
40 if (result) {
41 DWORD exit_code = 0;
42 if (::GetExitCodeThread(m_thread, &exit_code))
43 *result = exit_code;
44 else
45 *result = 0;
46 }
47 } else {
48 error = Status(::GetLastError(), eErrorTypeWin32);
49 }
50
51 Reset();
52 return error;
53}
54
56 if (!::QueueUserAPC(&ExitThreadProxy, m_thread, 0))
57 return Status(::GetLastError(), eErrorTypeWin32);
58 return Status();
59}
60
62 return ::GetThreadId(m_thread);
63}
64
71
73 return GetThreadId() == ::GetThreadId(thread);
74}
static llvm::raw_ostream & error(Stream &strm)
static void __stdcall ExitThreadProxy(ULONG_PTR dwExitCode)
HostNativeThreadBase(const HostNativeThreadBase &)=delete
Status Join(lldb::thread_result_t *result) override
bool EqualsThread(lldb::thread_t thread) const override
An error handling class.
Definition Status.h:118
#define LLDB_INVALID_HOST_THREAD
Definition lldb-types.h:69
A class that represents a running process on the host machine.
void * thread_result_t
Definition lldb-types.h:62
@ eErrorTypeWin32
Standard Win32 error codes.
pthread_t thread_t
Definition lldb-types.h:58
uint64_t tid_t
Definition lldb-types.h:84