1 //===-- HostThread.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_HostThread_h_
11 #define lldb_Host_HostThread_h_
12 
13 #include "lldb/Host/HostNativeThreadForward.h"
14 #include "lldb/Utility/Status.h"
15 #include "lldb/lldb-types.h"
16 
17 #include <memory>
18 
19 namespace lldb_private {
20 
21 class HostNativeThreadBase;
22 
23 //----------------------------------------------------------------------
24 /// @class HostInfo HostInfo.h "lldb/Host/HostThread.h"
25 /// A class that represents a thread running inside of a process on the
26 ///        local machine.
27 ///
28 /// HostThread allows querying and manipulation of threads running on the host
29 /// machine.
30 ///
31 //----------------------------------------------------------------------
32 class HostThread {
33 public:
34   HostThread();
35   HostThread(lldb::thread_t thread);
36 
37   Status Join(lldb::thread_result_t *result);
38   Status Cancel();
39   void Reset();
40   lldb::thread_t Release();
41 
42   bool IsJoinable() const;
43   HostNativeThread &GetNativeThread();
44   const HostNativeThread &GetNativeThread() const;
45   lldb::thread_result_t GetResult() const;
46 
47   bool EqualsThread(lldb::thread_t thread) const;
48 
49 private:
50   std::shared_ptr<HostNativeThreadBase> m_native_thread;
51 };
52 }
53 
54 #endif
55