semaphore.h 562 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2010-2020 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause
  4. */
  5. #ifndef BX_SEM_H_HEADER_GUARD
  6. #define BX_SEM_H_HEADER_GUARD
  7. #include "bx.h"
  8. namespace bx
  9. {
  10. ///
  11. class Semaphore
  12. {
  13. BX_CLASS(Semaphore
  14. , NO_COPY
  15. , NO_ASSIGNMENT
  16. );
  17. public:
  18. ///
  19. Semaphore();
  20. ///
  21. ~Semaphore();
  22. ///
  23. void post(uint32_t _count = 1);
  24. ///
  25. bool wait(int32_t _msecs = -1);
  26. private:
  27. BX_ALIGN_DECL(16, uint8_t) m_internal[128];
  28. };
  29. } // namespace bx
  30. #endif // BX_SEM_H_HEADER_GUARD