StdCondition.h 432 B

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