ThreadImpl.h 627 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #if IL2CPP_THREADS_STD
  3. #include "os/ErrorCodes.h"
  4. #include "os/Thread.h"
  5. #include "os/WaitStatus.h"
  6. #include "utils/NonCopyable.h"
  7. #include <thread>
  8. namespace il2cpp
  9. {
  10. namespace os
  11. {
  12. class ThreadImpl : public il2cpp::utils::NonCopyable
  13. {
  14. public:
  15. ThreadImpl();
  16. ~ThreadImpl();
  17. uint64_t Id();
  18. ErrorCode Run(Thread::StartFunc func, void* arg);
  19. WaitStatus Join();
  20. WaitStatus Join(uint32_t ms);
  21. static WaitStatus Sleep(uint32_t milliseconds);
  22. static uint64_t CurrentThreadId();
  23. private:
  24. std::thread m_Thread;
  25. };
  26. }
  27. }
  28. #endif