Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.1KB

  1. //
  2. // system_context.hpp
  3. // ~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_SYSTEM_CONTEXT_HPP
  11. #define ASIO_SYSTEM_CONTEXT_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/scheduler.hpp"
  17. #include "asio/detail/thread_group.hpp"
  18. #include "asio/execution_context.hpp"
  19. #include "asio/detail/push_options.hpp"
  20. namespace asio {
  21. class system_executor;
  22. /// The executor context for the system executor.
  23. class system_context : public execution_context
  24. {
  25. public:
  26. /// The executor type associated with the context.
  27. typedef system_executor executor_type;
  28. /// Destructor shuts down all threads in the system thread pool.
  29. ASIO_DECL ~system_context();
  30. /// Obtain an executor for the context.
  31. executor_type get_executor() ASIO_NOEXCEPT;
  32. /// Signal all threads in the system thread pool to stop.
  33. ASIO_DECL void stop();
  34. /// Determine whether the system thread pool has been stopped.
  35. ASIO_DECL bool stopped() const ASIO_NOEXCEPT;
  36. /// Join all threads in the system thread pool.
  37. ASIO_DECL void join();
  38. #if defined(GENERATING_DOCUMENTATION)
  39. private:
  40. #endif // defined(GENERATING_DOCUMENTATION)
  41. // Constructor creates all threads in the system thread pool.
  42. ASIO_DECL system_context();
  43. private:
  44. friend class system_executor;
  45. struct thread_function;
  46. // Helper function to create the underlying scheduler.
  47. ASIO_DECL detail::scheduler& add_scheduler(detail::scheduler* s);
  48. // The underlying scheduler.
  49. detail::scheduler& scheduler_;
  50. // The threads in the system thread pool.
  51. detail::thread_group threads_;
  52. };
  53. } // namespace asio
  54. #include "asio/detail/pop_options.hpp"
  55. #include "asio/impl/system_context.hpp"
  56. #if defined(ASIO_HEADER_ONLY)
  57. # include "asio/impl/system_context.ipp"
  58. #endif // defined(ASIO_HEADER_ONLY)
  59. #endif // ASIO_SYSTEM_CONTEXT_HPP