scheduler_task.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // detail/scheduler_task.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2023 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_DETAIL_SCHEDULER_TASK_HPP
  11. #define ASIO_DETAIL_SCHEDULER_TASK_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/op_queue.hpp"
  16. #include "asio/detail/push_options.hpp"
  17. namespace asio {
  18. namespace detail {
  19. class scheduler_operation;
  20. // Base class for all tasks that may be run by a scheduler.
  21. class scheduler_task
  22. {
  23. public:
  24. // Run the task once until interrupted or events are ready to be dispatched.
  25. virtual void run(long usec, op_queue<scheduler_operation>& ops) = 0;
  26. // Interrupt the task.
  27. virtual void interrupt() = 0;
  28. protected:
  29. // Prevent deletion through this type.
  30. ~scheduler_task()
  31. {
  32. }
  33. };
  34. } // namespace detail
  35. } // namespace asio
  36. #include "asio/detail/pop_options.hpp"
  37. #endif // ASIO_DETAIL_SCHEDULER_TASK_HPP