zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_mutex.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef _SDL_mutex_h
23 #define _SDL_mutex_h
24 
31 #include "SDL_stdinc.h"
32 #include "SDL_error.h"
33 
34 #include "begin_code.h"
35 /* Set up for C function definitions, even when using C++ */
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
44 #define SDL_MUTEX_TIMEDOUT 1
45 
49 #define SDL_MUTEX_MAXWAIT (~(Uint32)0)
50 
51 
55 /* @{ */
56 
57 /* The SDL mutex structure, defined in SDL_sysmutex.c */
58 struct SDL_mutex;
59 typedef struct SDL_mutex SDL_mutex;
60 
65 
71 #define SDL_mutexP(m) SDL_LockMutex(m)
72 extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
73 
79 extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
80 
89 #define SDL_mutexV(m) SDL_UnlockMutex(m)
90 extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
91 
95 extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
96 
97 /* @} *//* Mutex functions */
98 
99 
103 /* @{ */
104 
105 /* The SDL semaphore structure, defined in SDL_syssem.c */
106 struct SDL_semaphore;
107 typedef struct SDL_semaphore SDL_sem;
108 
112 extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
113 
117 extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
118 
124 extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
125 
132 extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
133 
143 extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
144 
150 extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
151 
156 
157 /* @} *//* Semaphore functions */
158 
159 
163 /* @{ */
164 
165 /* The SDL condition variable structure, defined in SDL_syscond.c */
166 struct SDL_cond;
167 typedef struct SDL_cond SDL_cond;
168 
198 
202 extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
203 
209 extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
210 
216 extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
217 
227 extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
228 
237 extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
238  SDL_mutex * mutex, Uint32 ms);
239 
240 /* @} *//* Condition variable functions */
241 
242 
243 /* Ends C function definitions when using C++ */
244 #ifdef __cplusplus
245 }
246 #endif
247 #include "close_code.h"
248 
249 #endif /* _SDL_mutex_h */
250 
251 /* vi: set ts=4 sw=4 expandtab: */
DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value)
Definition: SDL_syssem.c:85
DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond)
Definition: SDL_syscond.c:64
DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
Definition: SDL_syscond.c:160
DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem)
Definition: SDL_syssem.c:130
struct SDL_semaphore SDL_sem
Definition: SDL_mutex.h:107
DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms)
Definition: SDL_syssem.c:150
DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex)
Definition: SDL_sysmutex.c:73
DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem)
Definition: SDL_syssem.c:180
DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void)
Definition: SDL_sysmutex.c:38
#define DECLSPEC
Definition: begin_code.h:62
DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond)
Definition: SDL_syscond.c:106
#define SDLCALL
Definition: begin_code.h:72
DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex)
Definition: SDL_sysmutex.c:160
DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex *mutex)
Definition: SDL_sysmutex.c:103
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond)
Definition: SDL_syscond.c:82
DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem)
Definition: SDL_syssem.c:186
DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void)
Definition: SDL_syscond.c:42
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
Definition: SDL_syssem.c:111
struct SDL_mutex SDL_mutex
Definition: SDL_mutex.h:59
DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
Definition: SDL_sysmutex.c:61
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)
Definition: SDL_syssem.c:200
DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)
Definition: SDL_syscond.c:215
struct SDL_cond SDL_cond
Definition: SDL_mutex.h:167