cmDebuggerThreadManager.h 890 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <atomic>
  6. #include <cstdint>
  7. #include <list>
  8. #include <memory>
  9. #include <string>
  10. #include <cm/optional>
  11. namespace cmDebugger {
  12. class cmDebuggerThread;
  13. }
  14. namespace dap {
  15. struct StackTraceResponse;
  16. }
  17. namespace cmDebugger {
  18. class cmDebuggerThreadManager
  19. {
  20. static std::atomic<std::int64_t> NextThreadId;
  21. std::list<std::shared_ptr<cmDebuggerThread>> Threads;
  22. public:
  23. cmDebuggerThreadManager() = default;
  24. std::shared_ptr<cmDebuggerThread> StartThread(std::string const& name);
  25. void EndThread(std::shared_ptr<cmDebuggerThread> const& thread);
  26. cm::optional<dap::StackTraceResponse> GetThreadStackTraceResponse(
  27. std::int64_t id);
  28. };
  29. } // namespace cmDebugger