SDL_mutex.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef _SDL_mutex_h
  2. #define _SDL_mutex_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_error.h"
  5. #include "begin_code.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #define SDL_MUTEX_TIMEDOUT 1
  10. #define SDL_MUTEX_MAXWAIT (~(Uint32)0)
  11. struct SDL_mutex;
  12. typedef struct SDL_mutex SDL_mutex;
  13. typedef SDL_mutex * SDLCALL tSDL_CreateMutex(void);
  14. #define SDL_mutexP(m) SDL_LockMutex(m)
  15. typedef int SDLCALL tSDL_LockMutex(SDL_mutex * mutex);
  16. typedef int SDLCALL tSDL_TryLockMutex(SDL_mutex * mutex);
  17. #define SDL_mutexV(m) SDL_UnlockMutex(m)
  18. typedef int SDLCALL tSDL_UnlockMutex(SDL_mutex * mutex);
  19. typedef void SDLCALL tSDL_DestroyMutex(SDL_mutex * mutex);
  20. struct SDL_semaphore;
  21. typedef struct SDL_semaphore SDL_sem;
  22. typedef SDL_sem * SDLCALL tSDL_CreateSemaphore(Uint32 initial_value);
  23. typedef void SDLCALL tSDL_DestroySemaphore(SDL_sem * sem);
  24. typedef int SDLCALL tSDL_SemWait(SDL_sem * sem);
  25. typedef int SDLCALL tSDL_SemTryWait(SDL_sem * sem);
  26. typedef int SDLCALL tSDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
  27. typedef int SDLCALL tSDL_SemPost(SDL_sem * sem);
  28. typedef Uint32 SDLCALL tSDL_SemValue(SDL_sem * sem);
  29. struct SDL_cond;
  30. typedef struct SDL_cond SDL_cond;
  31. typedef SDL_cond * SDLCALL tSDL_CreateCond(void);
  32. typedef void SDLCALL tSDL_DestroyCond(SDL_cond * cond);
  33. typedef int SDLCALL tSDL_CondSignal(SDL_cond * cond);
  34. typedef int SDLCALL tSDL_CondBroadcast(SDL_cond * cond);
  35. typedef int SDLCALL tSDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
  36. typedef int SDLCALL tSDL_CondWaitTimeout(SDL_cond * cond,
  37. SDL_mutex * mutex, Uint32 ms);
  38. extern tSDL_CreateMutex *SDL_CreateMutex;
  39. extern tSDL_LockMutex *SDL_LockMutex;
  40. extern tSDL_TryLockMutex *SDL_TryLockMutex;
  41. extern tSDL_UnlockMutex *SDL_UnlockMutex;
  42. extern tSDL_DestroyMutex *SDL_DestroyMutex;
  43. extern tSDL_CreateSemaphore *SDL_CreateSemaphore;
  44. extern tSDL_DestroySemaphore *SDL_DestroySemaphore;
  45. extern tSDL_SemWait *SDL_SemWait;
  46. extern tSDL_SemTryWait *SDL_SemTryWait;
  47. extern tSDL_SemWaitTimeout *SDL_SemWaitTimeout;
  48. extern tSDL_SemPost *SDL_SemPost;
  49. extern tSDL_SemValue *SDL_SemValue;
  50. extern tSDL_CreateCond *SDL_CreateCond;
  51. extern tSDL_DestroyCond *SDL_DestroyCond;
  52. extern tSDL_CondSignal *SDL_CondSignal;
  53. extern tSDL_CondBroadcast *SDL_CondBroadcast;
  54. extern tSDL_CondWait *SDL_CondWait;
  55. extern tSDL_CondWaitTimeout *SDL_CondWaitTimeout;
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #include "close_code.h"
  60. #endif