General Purpose library for Freestanding C++ and POSIX systems
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

39 řádky
890 B

  1. #pragma once
  2. #include "gp_config.hpp"
  3. #include "gp/function.hpp"
  4. #include "gp/indexed_array.hpp"
  5. #include "gp/pointers.hpp"
  6. #include "gp/vfs/file_description.hpp"
  7. #include "gp/vfs/platforms/platform_autopicker.hpp"
  8. #include <atomic>
  9. namespace gp {
  10. enum class process_status {
  11. inactive = 0,
  12. running = 1,
  13. waiting = 2,
  14. finished = 3,
  15. zombie = 4
  16. };
  17. struct process_data{
  18. gp::function<void()> fn;
  19. void* stack;
  20. size_t stack_sz;
  21. gp::process_status state;
  22. std::atomic_bool is_running;
  23. [[no_unique_address]] gp::specifics::platform_data specifics;
  24. gp::indexed_array<gp::file_description*, gp_config::limits::max_fd_per_process> fds;
  25. process_data(gp::function<void()> _fn, void* _stack, size_t _stack_sz)
  26. : fn(_fn)
  27. , stack(_stack)
  28. , stack_sz(_stack_sz)
  29. , state(gp::process_status::inactive)
  30. , specifics(gp::buffer<char>{(char*)stack, stack_sz})
  31. {}
  32. };
  33. }