Condition.h 679 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #ifdef URHO3D_IS_BUILDING
  5. #include "Urho3D.h"
  6. #else
  7. #include <Urho3D/Urho3D.h>
  8. #endif
  9. namespace Urho3D
  10. {
  11. /// %Condition on which a thread can wait.
  12. class URHO3D_API Condition
  13. {
  14. public:
  15. /// Construct.
  16. Condition();
  17. /// Destruct.
  18. ~Condition();
  19. /// Set the condition. Will be automatically reset once a waiting thread wakes up.
  20. void Set();
  21. /// Wait on the condition.
  22. void Wait();
  23. private:
  24. #ifndef _WIN32
  25. /// Mutex for the event, necessary for pthreads-based implementation.
  26. void* mutex_;
  27. #endif
  28. /// Operating system specific event.
  29. void* event_;
  30. };
  31. }