HostThread.h 1.3 KB

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