General Purpose library for Freestanding C++ and POSIX systems
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.

43 lines
774 B

  1. #pragma once
  2. #include "gp/containers/indexed_array.hpp"
  3. #include "gp/system/process_data.hpp"
  4. #include "gp/system/task_queue.hpp"
  5. namespace gp {
  6. namespace system {
  7. class system;
  8. struct scheduler {
  9. task_queue::node_ptr previous;
  10. task_queue::node_ptr current;
  11. size_t id;
  12. system& sys;
  13. process_data main_context_data;
  14. task_queue::node main_context;
  15. no_inline_decl(
  16. void yield_to(task_queue::node_ptr target)
  17. );
  18. scheduler(system&, size_t token);
  19. scheduler(scheduler&& v)
  20. : previous(v.previous)
  21. , current(v.current)
  22. , id(v.id)
  23. , sys(v.sys)
  24. , main_context_data(gp::move(v.main_context_data))
  25. , main_context(gp::move(v.main_context))
  26. {}
  27. void run();
  28. void yield();
  29. ~scheduler() {
  30. }
  31. };
  32. }
  33. }