misc/winutils/include/SDL_mutex.h
changeset 10017 de822cd3df3a
parent 7809 7d4fb2f35f4f
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
    39 #endif
    39 #endif
    40 
    40 
    41 /** Synchronization functions which can time out return this value
    41 /** Synchronization functions which can time out return this value
    42  *  if they time out.
    42  *  if they time out.
    43  */
    43  */
    44 #define SDL_MUTEX_TIMEDOUT	1
    44 #define SDL_MUTEX_TIMEDOUT  1
    45 
    45 
    46 /** This is the timeout value which corresponds to never time out */
    46 /** This is the timeout value which corresponds to never time out */
    47 #define SDL_MUTEX_MAXWAIT	(~(Uint32)0)
    47 #define SDL_MUTEX_MAXWAIT   (~(Uint32)0)
    48 
    48 
    49 
    49 
    50 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    50 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    51 /** @name Mutex functions                                        */ /*@{*/
    51 /** @name Mutex functions                                        */ /*@{*/
    52 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    52 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    56 typedef struct SDL_mutex SDL_mutex;
    56 typedef struct SDL_mutex SDL_mutex;
    57 
    57 
    58 /** Create a mutex, initialized unlocked */
    58 /** Create a mutex, initialized unlocked */
    59 extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
    59 extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
    60 
    60 
    61 #define SDL_LockMutex(m)	SDL_mutexP(m)
    61 #define SDL_LockMutex(m)    SDL_mutexP(m)
    62 /** Lock the mutex
    62 /** Lock the mutex
    63  *  @return 0, or -1 on error
    63  *  @return 0, or -1 on error
    64  */
    64  */
    65 extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
    65 extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
    66 
    66 
    67 #define SDL_UnlockMutex(m)	SDL_mutexV(m)
    67 #define SDL_UnlockMutex(m)  SDL_mutexV(m)
    68 /** Unlock the mutex
    68 /** Unlock the mutex
    69  *  @return 0, or -1 on error
    69  *  @return 0, or -1 on error
    70  *
    70  *
    71  *  It is an error to unlock a mutex that has not been locked by
    71  *  It is an error to unlock a mutex that has not been locked by
    72  *  the current thread, and doing so results in undefined behavior.
    72  *  the current thread, and doing so results in undefined behavior.
    91 
    91 
    92 /** Destroy a semaphore */
    92 /** Destroy a semaphore */
    93 extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
    93 extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
    94 
    94 
    95 /**
    95 /**
    96  * This function suspends the calling thread until the semaphore pointed 
    96  * This function suspends the calling thread until the semaphore pointed
    97  * to by sem has a positive count. It then atomically decreases the semaphore
    97  * to by sem has a positive count. It then atomically decreases the semaphore
    98  * count.
    98  * count.
    99  */
    99  */
   100 extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
   100 extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
   101 
   101