condition.h 640 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include "mutex.h"
  5. namespace embree
  6. {
  7. class ConditionSys
  8. {
  9. public:
  10. ConditionSys();
  11. ~ConditionSys();
  12. void wait( class MutexSys& mutex );
  13. void notify_all();
  14. template<typename Predicate>
  15. __forceinline void wait( class MutexSys& mutex, const Predicate& pred )
  16. {
  17. while (!pred()) wait(mutex);
  18. }
  19. private:
  20. ConditionSys (const ConditionSys& other) DELETED; // do not implement
  21. ConditionSys& operator= (const ConditionSys& other) DELETED; // do not implement
  22. protected:
  23. void* cond;
  24. };
  25. }