StdCondition.h 410 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <thread>
  3. #include <mutex>
  4. #include <chrono>
  5. #include <condition_variable>
  6. class StdCondition
  7. {
  8. public:
  9. StdCondition();
  10. StdCondition(bool init);
  11. ~StdCondition();
  12. void Wait();
  13. bool WaitFor(unsigned int millisecond);
  14. void Notify(bool istrue);
  15. protected:
  16. static bool isTrue(StdCondition* scd);
  17. protected:
  18. bool m_value;
  19. std::mutex m_mutex;
  20. std::condition_variable m_cv;
  21. };