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.

39 lines
494 B

пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
  1. #pragma once
  2. #include "gp/indexed_array.hpp"
  3. #include "gp/vfs/process_data.hpp"
  4. namespace gp{
  5. class system;
  6. class scheduler {
  7. gp::specifics::platform_data root;
  8. size_t current = 0;
  9. system& sys;
  10. no_inline_decl(
  11. void yield_to(size_t target_pid)
  12. );
  13. public:
  14. scheduler(class system&);
  15. [[noreturn]] void run(allocator& alloc) {
  16. again:
  17. run_once();
  18. cleanup(alloc);
  19. goto again;
  20. }
  21. void cleanup(allocator& alloc);
  22. void run_once();
  23. void yield(){
  24. yield_to(0);
  25. }
  26. };
  27. }