23 #if SDL_THREAD_WINDOWS
27 #include "../../core/windows/SDL_windows.h"
29 #include "SDL_thread.h"
48 sem->id = CreateSemaphore(
NULL, initial_value, 32 * 1024,
NULL);
49 sem->count = initial_value;
85 dwMilliseconds = INFINITE;
87 dwMilliseconds = (
DWORD) timeout;
89 switch (WaitForSingleObject(sem->id, dwMilliseconds)) {
91 InterlockedDecrement(&sem->count);
124 return (
Uint32)sem->count;
138 InterlockedIncrement(&sem->count);
139 if (ReleaseSemaphore(sem->id, 1,
NULL) ==
FALSE) {
140 InterlockedDecrement(&sem->count);
DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value)
#define SDL_MUTEX_MAXWAIT
DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem)
struct SDL_semaphore SDL_sem
DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms)
DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem)
DECLSPEC void SDLCALL SDL_free(void *mem)
uint32_t Uint32
An unsigned 32-bit integer type.
typedef HANDLE(WINAPI *PFNWGLCREATEBUFFERREGIONARBPROC)(HDC hDC
DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem)
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
GLbitfield GLuint64 timeout
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
#define SDL_OutOfMemory()
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
#define SDL_MUTEX_TIMEDOUT
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)