]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Host/HostNativeThreadBase.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / 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 #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 Error Join(lldb::thread_result_t *result) = 0;
35   virtual Error Cancel() = 0;
36   virtual bool IsJoinable() const;
37   virtual void Reset();
38   lldb::thread_t Release();
39
40   lldb::thread_t GetSystemHandle() const;
41   lldb::thread_result_t GetResult() const;
42
43 protected:
44   static lldb::thread_result_t THREAD_ROUTINE
45   ThreadCreateTrampoline(lldb::thread_arg_t arg);
46
47   lldb::thread_t m_thread;
48   lldb::thread_result_t m_result;
49 };
50 }
51
52 #endif