Semaphore-c-api.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "WaitStatus-c-api.h"
  3. #if defined(__cplusplus)
  4. #include "os/Semaphore.h"
  5. typedef il2cpp::os::Semaphore UnityPalSemaphore;
  6. typedef il2cpp::os::SemaphoreHandle UnityPalSemaphoreHandle;
  7. #else
  8. typedef struct UnityPalSemaphore UnityPalSemaphore;
  9. typedef struct UnityPalSemaphoreHandle UnityPalSemaphoreHandle;
  10. #endif
  11. #if defined(__cplusplus)
  12. extern "C"
  13. {
  14. #endif
  15. UnityPalSemaphore* UnityPalSemaphoreNew(int32_t initialValue, int32_t maximumValue);
  16. void UnityPalSemaphoreDelete(UnityPalSemaphore* semaphore);
  17. int32_t UnityPalSemaphorePost(UnityPalSemaphore* semaphore, int32_t releaseCount, int32_t* previousCount);
  18. UnityPalWaitStatus UnityPalSemaphoreWait(UnityPalSemaphore* semaphore, int32_t interruptible);
  19. UnityPalWaitStatus UnityPalSemaphoreWaitMs(UnityPalSemaphore* semaphore, uint32_t ms, int32_t interruptible);
  20. UnityPalSemaphoreHandle* UnityPalSemaphoreHandleNew(UnityPalSemaphore* semaphore);
  21. void UnityPalSemaphoreHandleDelete(UnityPalSemaphoreHandle* handle);
  22. int32_t UnityPalSemaphoreHandleWait(UnityPalSemaphoreHandle* handle);
  23. int32_t UnityPalSemaphoreHandleWaitMs(UnityPalSemaphoreHandle* handle, uint32_t ms);
  24. void UnityPalSemaphoreHandleSignal(UnityPalSemaphoreHandle* handle);
  25. UnityPalSemaphore* UnityPalSemaphoreHandleGet(UnityPalSemaphoreHandle* handle);
  26. #if defined(__cplusplus)
  27. }
  28. #endif