World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
SDL_mutex.h
См. документацию.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 
64 extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
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 
155 extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
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 
197 extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
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: */
SDL_sem
struct SDL_semaphore SDL_sem
Definition: SDL_mutex.h:107
SDL_error.h
SDL_CondBroadcast
DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond)
SDL_CondWaitTimeout
DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
SDL_SemWaitTimeout
DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms)
close_code.h
begin_code.h
SDL_CreateCond
DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void)
SDL_CreateMutex
DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void)
SDL_SemWait
DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem)
SDL_CreateSemaphore
DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value)
SDL_LockMutex
DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex)
SDL_DestroyMutex
DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
SDL_SemValue
DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem)
SDL_CondSignal
DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond)
SDL_DestroyCond
DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond)
SDL_CondWait
DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex)
SDL_SemTryWait
DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem)
SDL_stdinc.h
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_cond
struct SDL_cond SDL_cond
Definition: SDL_mutex.h:167
SDL_mutex
struct SDL_mutex SDL_mutex
Definition: SDL_mutex.h:59
SDL_DestroySemaphore
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
SDL_SemPost
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)
SDL_UnlockMutex
DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex)
SDL_TryLockMutex
DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex *mutex)