Thread.hpp 580 B

123456789101112131415161718192021222324252627
  1. #ifndef CORE_THREAD_HPP
  2. #define CORE_THREAD_HPP
  3. #include <threads.h>
  4. #include "core/utils/Check.hpp"
  5. namespace Core {
  6. class Thread final {
  7. thrd_t thread;
  8. public:
  9. using Function = int (*)(void*);
  10. Thread();
  11. Thread(const Thread& other) = delete;
  12. Thread(Thread&& other);
  13. ~Thread();
  14. Thread& operator=(const Thread& other) = delete;
  15. Thread& operator=(Thread&& other);
  16. void swap(Thread& other);
  17. cbool start(Function f, void* p);
  18. cbool join(int* returnValue = nullptr);
  19. };
  20. }
  21. #endif