early-access version 2281
This commit is contained in:
6
externals/SDL/src/thread/psp/SDL_syssem.c
vendored
6
externals/SDL/src/thread/psp/SDL_syssem.c
vendored
@@ -43,13 +43,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_sem *sem;
|
||||
|
||||
sem = (SDL_sem *) malloc(sizeof(*sem));
|
||||
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
|
||||
if (sem != NULL) {
|
||||
/* TODO: Figure out the limit on the maximum value. */
|
||||
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
|
||||
if (sem->semid < 0) {
|
||||
SDL_SetError("Couldn't create semaphore");
|
||||
free(sem);
|
||||
SDL_free(sem);
|
||||
sem = NULL;
|
||||
}
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
sem->semid = 0;
|
||||
}
|
||||
|
||||
free(sem);
|
||||
SDL_free(sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
21
externals/SDL/src/thread/pthread/SDL_systhread.c
vendored
21
externals/SDL/src/thread/pthread/SDL_systhread.c
vendored
@@ -41,7 +41,7 @@
|
||||
#include "../../core/linux/SDL_dbus.h"
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
#if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
#if (defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)) && defined(HAVE_DLOPEN)
|
||||
#include <dlfcn.h>
|
||||
#ifndef RTLD_DEFAULT
|
||||
#define RTLD_DEFAULT NULL
|
||||
@@ -78,10 +78,10 @@ RunThread(void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__)) && defined(HAVE_DLOPEN)
|
||||
static SDL_bool checked_setname = SDL_FALSE;
|
||||
static int (*ppthread_setname_np)(const char*) = NULL;
|
||||
#elif defined(__LINUX__)
|
||||
#elif defined(__LINUX__) && defined(HAVE_DLOPEN)
|
||||
static SDL_bool checked_setname = SDL_FALSE;
|
||||
static int (*ppthread_setname_np)(pthread_t, const char*) = NULL;
|
||||
#endif
|
||||
@@ -91,7 +91,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread)
|
||||
pthread_attr_t type;
|
||||
|
||||
/* do this here before any threads exist, so there's no race condition. */
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
if (!checked_setname) {
|
||||
void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
@@ -131,7 +131,7 @@ SDL_SYS_SetupThread(const char *name)
|
||||
#endif /* !__NACL__ */
|
||||
|
||||
if (name != NULL) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
SDL_assert(checked_setname);
|
||||
if (ppthread_setname_np != NULL) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
@@ -183,17 +183,6 @@ SDL_ThreadID(void)
|
||||
return ((SDL_threadID) pthread_self());
|
||||
}
|
||||
|
||||
#if __LINUX__
|
||||
/**
|
||||
\brief Sets the SDL priority (not nice level) for a thread, using setpriority() if appropriate, and RealtimeKit if available.
|
||||
Differs from SDL_LinuxSetThreadPriority in also taking the desired scheduler policy,
|
||||
such as SCHED_OTHER or SCHED_RR.
|
||||
|
||||
\return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
|
||||
#endif
|
||||
|
||||
int
|
||||
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
|
6
externals/SDL/src/thread/vita/SDL_syssem.c
vendored
6
externals/SDL/src/thread/vita/SDL_syssem.c
vendored
@@ -44,13 +44,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_sem *sem;
|
||||
|
||||
sem = (SDL_sem *) malloc(sizeof(*sem));
|
||||
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
|
||||
if (sem != NULL) {
|
||||
/* TODO: Figure out the limit on the maximum value. */
|
||||
sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
|
||||
if (sem->semid < 0) {
|
||||
SDL_SetError("Couldn't create semaphore");
|
||||
free(sem);
|
||||
SDL_free(sem);
|
||||
sem = NULL;
|
||||
}
|
||||
} else {
|
||||
@@ -69,7 +69,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
sem->semid = 0;
|
||||
}
|
||||
|
||||
free(sem);
|
||||
SDL_free(sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
73
externals/SDL/src/thread/vita/SDL_systhread.c
vendored
73
externals/SDL/src/thread/vita/SDL_systhread.c
vendored
@@ -34,6 +34,15 @@
|
||||
#include <psp2/types.h>
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
|
||||
#define VITA_THREAD_STACK_SIZE_MIN 0x1000 // 4KiB
|
||||
#define VITA_THREAD_STACK_SIZE_MAX 0x2000000 // 32MiB
|
||||
#define VITA_THREAD_STACK_SIZE_DEFAULT 0x10000 // 64KiB
|
||||
#define VITA_THREAD_NAME_MAX 32
|
||||
|
||||
#define VITA_THREAD_PRIORITY_LOW 191
|
||||
#define VITA_THREAD_PRIORITY_NORMAL 160
|
||||
#define VITA_THREAD_PRIORITY_HIGH 112
|
||||
#define VITA_THREAD_PRIORITY_TIME_CRITICAL 64
|
||||
|
||||
static int ThreadEntry(SceSize args, void *argp)
|
||||
{
|
||||
@@ -43,17 +52,34 @@ static int ThreadEntry(SceSize args, void *argp)
|
||||
|
||||
int SDL_SYS_CreateThread(SDL_Thread *thread)
|
||||
{
|
||||
SceKernelThreadInfo info;
|
||||
int priority = 32;
|
||||
char thread_name[VITA_THREAD_NAME_MAX];
|
||||
size_t stack_size = VITA_THREAD_STACK_SIZE_DEFAULT;
|
||||
|
||||
/* Set priority of new thread to the same as the current thread */
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
if (sceKernelGetThreadInfo(sceKernelGetThreadId(), &info) == 0) {
|
||||
priority = info.currentPriority;
|
||||
SDL_strlcpy(thread_name, "SDL thread", VITA_THREAD_NAME_MAX);
|
||||
if (thread->name) {
|
||||
SDL_strlcpy(thread_name, thread->name, VITA_THREAD_NAME_MAX);
|
||||
}
|
||||
|
||||
thread->handle = sceKernelCreateThread("SDL thread", ThreadEntry,
|
||||
priority, 0x10000, 0, 0, NULL);
|
||||
if (thread->stacksize) {
|
||||
if (thread->stacksize < VITA_THREAD_STACK_SIZE_MIN) {
|
||||
thread->stacksize = VITA_THREAD_STACK_SIZE_MIN;
|
||||
}
|
||||
if (thread->stacksize > VITA_THREAD_STACK_SIZE_MAX) {
|
||||
thread->stacksize = VITA_THREAD_STACK_SIZE_MAX;
|
||||
}
|
||||
stack_size = thread->stacksize;
|
||||
}
|
||||
|
||||
/* Create new thread with the same priority as the current thread */
|
||||
thread->handle = sceKernelCreateThread(
|
||||
thread_name, // name
|
||||
ThreadEntry, // function to run
|
||||
0, // priority. 0 means priority of calling thread
|
||||
stack_size, // stack size
|
||||
0, // attibutes. always 0
|
||||
0, // cpu affinity mask. 0 = all CPUs
|
||||
NULL // opt. always NULL
|
||||
);
|
||||
|
||||
if (thread->handle < 0) {
|
||||
return SDL_SetError("sceKernelCreateThread() failed");
|
||||
@@ -81,28 +107,29 @@ void SDL_SYS_WaitThread(SDL_Thread *thread)
|
||||
|
||||
void SDL_SYS_DetachThread(SDL_Thread *thread)
|
||||
{
|
||||
/* !!! FIXME: is this correct? */
|
||||
sceKernelDeleteThread(thread->handle);
|
||||
}
|
||||
|
||||
void SDL_SYS_KillThread(SDL_Thread *thread)
|
||||
{
|
||||
sceKernelDeleteThread(thread->handle);
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
int value;
|
||||
int value = VITA_THREAD_PRIORITY_NORMAL;
|
||||
|
||||
if (priority == SDL_THREAD_PRIORITY_LOW) {
|
||||
value = 19;
|
||||
} else if (priority == SDL_THREAD_PRIORITY_HIGH) {
|
||||
value = -20;
|
||||
} else {
|
||||
value = 0;
|
||||
switch(priority) {
|
||||
case SDL_THREAD_PRIORITY_LOW:
|
||||
value = VITA_THREAD_PRIORITY_LOW;
|
||||
break;
|
||||
case SDL_THREAD_PRIORITY_NORMAL:
|
||||
value = VITA_THREAD_PRIORITY_NORMAL;
|
||||
break;
|
||||
case SDL_THREAD_PRIORITY_HIGH:
|
||||
value = VITA_THREAD_PRIORITY_HIGH;
|
||||
break;
|
||||
case SDL_THREAD_PRIORITY_TIME_CRITICAL:
|
||||
value = VITA_THREAD_PRIORITY_TIME_CRITICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return sceKernelChangeThreadPriority(sceKernelGetThreadId(),value);
|
||||
return sceKernelChangeThreadPriority(0, value);
|
||||
|
||||
}
|
||||
|
||||
|
299
externals/SDL/src/thread/windows/SDL_syscond_cv.c
vendored
Executable file
299
externals/SDL/src/thread/windows/SDL_syscond_cv.c
vendored
Executable file
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_thread.h"
|
||||
|
||||
#include "../generic/SDL_syscond_c.h"
|
||||
#include "SDL_sysmutex_c.h"
|
||||
|
||||
typedef SDL_cond * (*pfnSDL_CreateCond)(void);
|
||||
typedef void (*pfnSDL_DestroyCond)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondSignal)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondBroadcast)(SDL_cond *);
|
||||
typedef int (*pfnSDL_CondWait)(SDL_cond *, SDL_mutex *);
|
||||
typedef int (*pfnSDL_CondWaitTimeout)(SDL_cond *, SDL_mutex *, Uint32);
|
||||
|
||||
typedef struct SDL_cond_impl_t
|
||||
{
|
||||
pfnSDL_CreateCond Create;
|
||||
pfnSDL_DestroyCond Destroy;
|
||||
pfnSDL_CondSignal Signal;
|
||||
pfnSDL_CondBroadcast Broadcast;
|
||||
pfnSDL_CondWait Wait;
|
||||
pfnSDL_CondWaitTimeout WaitTimeout;
|
||||
} SDL_cond_impl_t;
|
||||
|
||||
/* Implementation will be chosen at runtime based on available Kernel features */
|
||||
static SDL_cond_impl_t SDL_cond_impl_active = {0};
|
||||
|
||||
|
||||
/**
|
||||
* Native Windows Condition Variable (SRW Locks)
|
||||
*/
|
||||
|
||||
#ifndef CONDITION_VARIABLE_INIT
|
||||
#define CONDITION_VARIABLE_INIT {0}
|
||||
typedef struct CONDITION_VARIABLE {
|
||||
PVOID Ptr;
|
||||
} CONDITION_VARIABLE, *PCONDITION_VARIABLE;
|
||||
#endif
|
||||
|
||||
#if __WINRT__
|
||||
#define pWakeConditionVariable WakeConditionVariable
|
||||
#define pWakeAllConditionVariable WakeAllConditionVariable
|
||||
#define pSleepConditionVariableSRW SleepConditionVariableSRW
|
||||
#define pSleepConditionVariableCS SleepConditionVariableCS
|
||||
#else
|
||||
typedef VOID(WINAPI *pfnWakeConditionVariable)(PCONDITION_VARIABLE);
|
||||
typedef VOID(WINAPI *pfnWakeAllConditionVariable)(PCONDITION_VARIABLE);
|
||||
typedef BOOL(WINAPI *pfnSleepConditionVariableSRW)(PCONDITION_VARIABLE, PSRWLOCK, DWORD, ULONG);
|
||||
typedef BOOL(WINAPI* pfnSleepConditionVariableCS)(PCONDITION_VARIABLE, PCRITICAL_SECTION, DWORD);
|
||||
|
||||
static pfnWakeConditionVariable pWakeConditionVariable = NULL;
|
||||
static pfnWakeAllConditionVariable pWakeAllConditionVariable = NULL;
|
||||
static pfnSleepConditionVariableSRW pSleepConditionVariableSRW = NULL;
|
||||
static pfnSleepConditionVariableCS pSleepConditionVariableCS = NULL;
|
||||
#endif
|
||||
|
||||
typedef struct SDL_cond_cv
|
||||
{
|
||||
CONDITION_VARIABLE cond;
|
||||
} SDL_cond_cv;
|
||||
|
||||
|
||||
static SDL_cond *
|
||||
SDL_CreateCond_cv(void)
|
||||
{
|
||||
SDL_cond_cv *cond;
|
||||
|
||||
/* Relies on CONDITION_VARIABLE_INIT == 0. */
|
||||
cond = (SDL_cond_cv *) SDL_calloc(1, sizeof(*cond));
|
||||
if (!cond) {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
return (SDL_cond *)cond;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_DestroyCond_cv(SDL_cond * cond)
|
||||
{
|
||||
if (cond) {
|
||||
/* There are no kernel allocated resources */
|
||||
SDL_free(cond);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_CondSignal_cv(SDL_cond * _cond)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
if (!cond) {
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
pWakeConditionVariable(&cond->cond);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_CondBroadcast_cv(SDL_cond * _cond)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
if (!cond) {
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
pWakeAllConditionVariable(&cond->cond);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms)
|
||||
{
|
||||
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
|
||||
DWORD timeout;
|
||||
int ret;
|
||||
|
||||
if (!cond) {
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
if (!_mutex) {
|
||||
return SDL_SetError("Passed a NULL mutex");
|
||||
}
|
||||
|
||||
if (ms == SDL_MUTEX_MAXWAIT) {
|
||||
timeout = INFINITE;
|
||||
} else {
|
||||
timeout = (DWORD) ms;
|
||||
}
|
||||
|
||||
if (SDL_mutex_impl_active.Type == SDL_MUTEX_SRW) {
|
||||
SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex;
|
||||
|
||||
if (mutex->count != 1 || mutex->owner != GetCurrentThreadId()) {
|
||||
return SDL_SetError("Passed mutex is not locked or locked recursively");
|
||||
}
|
||||
|
||||
/* The mutex must be updated to the released state */
|
||||
mutex->count = 0;
|
||||
mutex->owner = 0;
|
||||
|
||||
if (pSleepConditionVariableSRW(&cond->cond, &mutex->srw, timeout, 0) == FALSE) {
|
||||
if (GetLastError() == ERROR_TIMEOUT) {
|
||||
ret = SDL_MUTEX_TIMEDOUT;
|
||||
} else {
|
||||
ret = SDL_SetError("SleepConditionVariableSRW() failed");
|
||||
}
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
/* The mutex is owned by us again, regardless of status of the wait */
|
||||
SDL_assert(mutex->count == 0 && mutex->owner == 0);
|
||||
mutex->count = 1;
|
||||
mutex->owner = GetCurrentThreadId();
|
||||
} else {
|
||||
SDL_mutex_cs *mutex = (SDL_mutex_cs *)_mutex;
|
||||
|
||||
SDL_assert(SDL_mutex_impl_active.Type == SDL_MUTEX_CS);
|
||||
|
||||
if (pSleepConditionVariableCS(&cond->cond, &mutex->cs, timeout) == FALSE) {
|
||||
if (GetLastError() == ERROR_TIMEOUT) {
|
||||
ret = SDL_MUTEX_TIMEDOUT;
|
||||
} else {
|
||||
ret = SDL_SetError("SleepConditionVariableCS() failed");
|
||||
}
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_CondWait_cv(SDL_cond * cond, SDL_mutex * mutex) {
|
||||
return SDL_CondWaitTimeout_cv(cond, mutex, SDL_MUTEX_MAXWAIT);
|
||||
}
|
||||
|
||||
static const SDL_cond_impl_t SDL_cond_impl_cv =
|
||||
{
|
||||
&SDL_CreateCond_cv,
|
||||
&SDL_DestroyCond_cv,
|
||||
&SDL_CondSignal_cv,
|
||||
&SDL_CondBroadcast_cv,
|
||||
&SDL_CondWait_cv,
|
||||
&SDL_CondWaitTimeout_cv,
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic Condition Variable implementation using SDL_mutex and SDL_sem
|
||||
*/
|
||||
|
||||
static const SDL_cond_impl_t SDL_cond_impl_generic =
|
||||
{
|
||||
&SDL_CreateCond_generic,
|
||||
&SDL_DestroyCond_generic,
|
||||
&SDL_CondSignal_generic,
|
||||
&SDL_CondBroadcast_generic,
|
||||
&SDL_CondWait_generic,
|
||||
&SDL_CondWaitTimeout_generic,
|
||||
};
|
||||
|
||||
|
||||
SDL_cond *
|
||||
SDL_CreateCond(void)
|
||||
{
|
||||
if (SDL_cond_impl_active.Create == NULL) {
|
||||
/* Default to generic implementation, works with all mutex implementations */
|
||||
const SDL_cond_impl_t * impl = &SDL_cond_impl_generic;
|
||||
|
||||
if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) {
|
||||
/* The mutex implementation isn't decided yet, trigger it */
|
||||
SDL_mutex *mutex = SDL_CreateMutex();
|
||||
if (!mutex) {
|
||||
return NULL;
|
||||
}
|
||||
SDL_DestroyMutex(mutex);
|
||||
|
||||
SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID);
|
||||
}
|
||||
|
||||
#if __WINRT__
|
||||
/* Link statically on this platform */
|
||||
impl = &SDL_cond_impl_cv;
|
||||
#else
|
||||
{
|
||||
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
|
||||
if (kernel32) {
|
||||
pWakeConditionVariable = (pfnWakeConditionVariable) GetProcAddress(kernel32, "WakeConditionVariable");
|
||||
pWakeAllConditionVariable = (pfnWakeAllConditionVariable) GetProcAddress(kernel32, "WakeAllConditionVariable");
|
||||
pSleepConditionVariableSRW = (pfnSleepConditionVariableSRW) GetProcAddress(kernel32, "SleepConditionVariableSRW");
|
||||
pSleepConditionVariableCS = (pfnSleepConditionVariableCS) GetProcAddress(kernel32, "SleepConditionVariableCS");
|
||||
if (pWakeConditionVariable && pWakeAllConditionVariable && pSleepConditionVariableSRW && pSleepConditionVariableCS) {
|
||||
/* Use the Windows provided API */
|
||||
impl = &SDL_cond_impl_cv;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_memcpy(&SDL_cond_impl_active, impl, sizeof(SDL_cond_impl_active));
|
||||
}
|
||||
return SDL_cond_impl_active.Create();
|
||||
}
|
||||
|
||||
void
|
||||
SDL_DestroyCond(SDL_cond * cond)
|
||||
{
|
||||
SDL_cond_impl_active.Destroy(cond);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_CondSignal(SDL_cond * cond)
|
||||
{
|
||||
return SDL_cond_impl_active.Signal(cond);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_CondBroadcast(SDL_cond * cond)
|
||||
{
|
||||
return SDL_cond_impl_active.Broadcast(cond);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
||||
{
|
||||
return SDL_cond_impl_active.WaitTimeout(cond, mutex, ms);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
|
||||
{
|
||||
return SDL_cond_impl_active.Wait(cond, mutex);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -169,11 +169,6 @@ static const SDL_mutex_impl_t SDL_mutex_impl_srw =
|
||||
* Fallback Mutex implementation using Critical Sections (before Win 7)
|
||||
*/
|
||||
|
||||
typedef struct SDL_mutex_cs
|
||||
{
|
||||
CRITICAL_SECTION cs;
|
||||
} SDL_mutex_cs;
|
||||
|
||||
/* Create a mutex */
|
||||
static SDL_mutex *
|
||||
SDL_CreateMutex_cs(void)
|
||||
|
@@ -66,4 +66,9 @@ typedef struct SDL_mutex_srw
|
||||
DWORD owner;
|
||||
} SDL_mutex_srw;
|
||||
|
||||
typedef struct SDL_mutex_cs
|
||||
{
|
||||
CRITICAL_SECTION cs;
|
||||
} SDL_mutex_cs;
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user