condition_variable.h 592 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2012-2018 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/dbartolini/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "core/thread/mutex.h"
  7. namespace crown
  8. {
  9. /// Condition variable.
  10. ///
  11. /// @ingroup Thread
  12. struct ConditionVariable
  13. {
  14. CE_ALIGN_DECL(16, u8 _data[64]);
  15. ///
  16. ConditionVariable();
  17. ///
  18. ~ConditionVariable();
  19. ///
  20. ConditionVariable(const ConditionVariable&) = delete;
  21. ///
  22. ConditionVariable& operator=(const ConditionVariable&) = delete;
  23. ///
  24. void wait(Mutex& mutex);
  25. ///
  26. void signal();
  27. };
  28. } // namespace crown