]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h
Merge ^/head r305220 through r305300.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / HostNativeThreadBase.h
1 //===-- HostNativeThreadBase.h ----------------------------------*- 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 #ifndef lldb_Host_HostNativeThreadBase_h_
11 #define lldb_Host_HostNativeThreadBase_h_
12
13 #include "lldb/Core/Error.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-types.h"
16
17 namespace lldb_private
18 {
19
20 #if defined(_WIN32)
21 #define THREAD_ROUTINE __stdcall
22 #else
23 #define THREAD_ROUTINE
24 #endif
25
26 class HostNativeThreadBase
27 {
28     friend class ThreadLauncher;
29     DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
30
31   public:
32     HostNativeThreadBase();
33     explicit HostNativeThreadBase(lldb::thread_t thread);
34     virtual ~HostNativeThreadBase() {}
35
36     virtual Error Join(lldb::thread_result_t *result) = 0;
37     virtual Error Cancel() = 0;
38     virtual bool IsJoinable() const;
39     virtual void Reset();
40     lldb::thread_t Release();
41
42     lldb::thread_t GetSystemHandle() const;
43     lldb::thread_result_t GetResult() const;
44
45   protected:
46     static lldb::thread_result_t THREAD_ROUTINE ThreadCreateTrampoline(lldb::thread_arg_t arg);
47
48     lldb::thread_t m_thread;
49     lldb::thread_result_t m_result;
50 };
51 }
52
53 #endif