Mutex-c-api.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #if defined(__cplusplus)
  3. #include "os/Mutex.h"
  4. #include "os/WaitStatus.h"
  5. typedef il2cpp::os::Mutex UnityPalMutex;
  6. typedef il2cpp::os::MutexHandle UnityPalMutexHandle;
  7. typedef il2cpp::os::FastMutex UnityPalFastMutex;
  8. typedef il2cpp::os::FastMutexImpl UnityPalFastMutexImpl;
  9. #else
  10. typedef struct UnityPalMutex UnityPalMutex;
  11. typedef struct UnityPalMutexHandle UnityPalMutexHandle;
  12. typedef struct UnityPalFastMutex UnityPalFastMutex;
  13. typedef struct UnityPalFastMutexImpl UnityPalFastMutexImpl;
  14. #endif
  15. #if defined(__cplusplus)
  16. extern "C"
  17. {
  18. #endif
  19. UnityPalMutex* UnityPalMutexNew(int32_t initiallyOwned);
  20. void UnityPalMutexDelete(UnityPalMutex* mutex);
  21. void UnityPalMutexLock(UnityPalMutex* mutex, int32_t interruptible);
  22. int32_t UnityPalMutexTryLock(UnityPalMutex* mutex, uint32_t milliseconds, int32_t interruptible);
  23. void UnityPalMutexUnlock(UnityPalMutex* mutex);
  24. UnityPalMutexHandle* UnityPalMutexHandleNew(UnityPalMutex* mutex);
  25. void UnityPalMutexHandleDelete(UnityPalMutexHandle* mutex);
  26. int32_t UnityPalMutexHandleWait(UnityPalMutexHandle* handle);
  27. int32_t UnityPalMutexHandleWaitMs(UnityPalMutexHandle* handle, uint32_t ms);
  28. void UnityPalMutexHandleSignal(UnityPalMutexHandle* handle);
  29. UnityPalMutex* UnityPalMutexHandleGet(UnityPalMutexHandle* handle);
  30. UnityPalFastMutex* UnityPalFastMutexNew();
  31. void UnityPalFastMutexDelete(UnityPalFastMutex* fastMutex);
  32. void UnityPalFastMutexLock(UnityPalFastMutex* fastMutex);
  33. void UnityPalFastMutexUnlock(UnityPalFastMutex* fastMutex);
  34. UnityPalFastMutexImpl* UnityPalFastMutexGetImpl(UnityPalFastMutex* fastMutex);
  35. #if defined(__cplusplus)
  36. }
  37. #endif