1
0

nxsemaphore.c 437 B

123456789101112131415161718192021222324
  1. #include "nxsemaphore.h"
  2. #include "foundation/error.h"
  3. int NXSemaphoreCreate(nx_semaphore_t *sem)
  4. {
  5. *sem = CreateSemaphore(0, 0, LONG_MAX, 0);
  6. return NErr_Success;
  7. }
  8. int NXSemaphoreRelease(nx_semaphore_t sem)
  9. {
  10. ReleaseSemaphore(sem, 1, 0);
  11. return NErr_Success;
  12. }
  13. int NXSemaphoreWait(nx_semaphore_t sem)
  14. {
  15. WaitForSingleObject(sem, INFINITE);
  16. return NErr_Success;
  17. }
  18. void NXSemaphoreClose(nx_semaphore_t sem)
  19. {
  20. CloseHandle(sem);
  21. }