]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[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/Utility/Status.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-types.h"
16
17 namespace lldb_private {
18
19 #if defined(_WIN32)
20 #define THREAD_ROUTINE __stdcall
21 #else
22 #define THREAD_ROUTINE
23 #endif
24
25 class HostNativeThreadBase {
26   friend class ThreadLauncher;
27   DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
28
29 public:
30   HostNativeThreadBase();
31   explicit HostNativeThreadBase(lldb::thread_t thread);
32   virtual ~HostNativeThreadBase() {}
33
34   virtual Status Join(lldb::thread_result_t *result) = 0;
35   virtual Status Cancel() = 0;
36   virtual bool IsJoinable() const;
37   virtual void Reset();
38   virtual bool EqualsThread(lldb::thread_t thread) const;
39   lldb::thread_t Release();
40
41   lldb::thread_t GetSystemHandle() const;
42   lldb::thread_result_t GetResult() const;
43
44 protected:
45   static lldb::thread_result_t THREAD_ROUTINE
46   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