mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-25 22:35:37 +00:00
Updates SDL to version 2.0.4, which makes it compatible with VS2015.
This commit is contained in:
parent
7b52fed504
commit
b63ef177f4
924 changed files with 79241 additions and 39934 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -442,10 +442,10 @@ SDL_DetachThread(SDL_Thread * thread)
|
|||
SDL_SYS_DetachThread(thread);
|
||||
} else {
|
||||
/* all other states are pretty final, see where we landed. */
|
||||
const int state = SDL_AtomicGet(&thread->state);
|
||||
if ((state == SDL_THREAD_STATE_DETACHED) || (state == SDL_THREAD_STATE_CLEANED)) {
|
||||
const int thread_state = SDL_AtomicGet(&thread->state);
|
||||
if ((thread_state == SDL_THREAD_STATE_DETACHED) || (thread_state == SDL_THREAD_STATE_CLEANED)) {
|
||||
return; /* already detached (you shouldn't call this twice!) */
|
||||
} else if (state == SDL_THREAD_STATE_ZOMBIE) {
|
||||
} else if (thread_state == SDL_THREAD_STATE_ZOMBIE) {
|
||||
SDL_WaitThread(thread, NULL); /* already done, clean it up. */
|
||||
} else {
|
||||
SDL_assert(0 && "Unexpected thread state");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_THREAD_PSP
|
||||
|
||||
/* An implementation of condition variables using semaphores and mutexes */
|
||||
/*
|
||||
This implementation borrows heavily from the BeOS condition variable
|
||||
|
|
@ -217,4 +219,6 @@ SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
|
|||
return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
|
||||
}
|
||||
|
||||
#endif /* SDL_THREAD_PSP */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_THREAD_PSP
|
||||
|
||||
/* An implementation of mutexes using semaphores */
|
||||
|
||||
#include "SDL_thread.h"
|
||||
|
|
@ -129,4 +131,6 @@ SDL_mutexV(SDL_mutex * mutex)
|
|||
#endif /* SDL_THREADS_DISABLED */
|
||||
}
|
||||
|
||||
#endif /* SDL_THREAD_PSP */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -18,6 +18,9 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_THREAD_PSP
|
||||
|
||||
/* Semaphore functions for the PSP. */
|
||||
|
||||
|
|
@ -76,7 +79,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
|||
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
{
|
||||
Uint32 *pTimeout;
|
||||
unsigned int res;
|
||||
int res;
|
||||
|
||||
if (sem == NULL) {
|
||||
SDL_SetError("Passed a NULL sem");
|
||||
|
|
@ -152,5 +155,7 @@ int SDL_SemPost(SDL_sem *sem)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_THREAD_PSP */
|
||||
|
||||
/* vim: ts=4 sw=4
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -18,7 +18,9 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_THREAD_PSP
|
||||
|
||||
/* PSP thread management routines for SDL */
|
||||
|
||||
|
|
@ -104,5 +106,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
|||
|
||||
}
|
||||
|
||||
#endif /* SDL_THREAD_PSP */
|
||||
|
||||
/* vim: ts=4 sw=4
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
#include "../../SDL_internal.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
|
@ -98,17 +99,26 @@ int
|
|||
SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
||||
{
|
||||
int retval;
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
struct timeval delta;
|
||||
#endif
|
||||
struct timespec abstime;
|
||||
|
||||
if (!cond) {
|
||||
return SDL_SetError("Passed a NULL condition variable");
|
||||
}
|
||||
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
|
||||
abstime.tv_nsec += (ms % 1000) * 1000000;
|
||||
abstime.tv_sec += ms / 1000;
|
||||
#else
|
||||
gettimeofday(&delta, NULL);
|
||||
|
||||
abstime.tv_sec = delta.tv_sec + (ms / 1000);
|
||||
abstime.tv_nsec = (delta.tv_usec + (ms % 1000) * 1000) * 1000;
|
||||
#endif
|
||||
if (abstime.tv_nsec > 1000000000) {
|
||||
abstime.tv_sec += 1;
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -20,9 +20,11 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "SDL_thread.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -20,10 +20,14 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
|
|
@ -102,7 +106,9 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
|||
{
|
||||
int retval;
|
||||
#ifdef HAVE_SEM_TIMEDWAIT
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
struct timeval now;
|
||||
#endif
|
||||
struct timespec ts_timeout;
|
||||
#else
|
||||
Uint32 end;
|
||||
|
|
@ -125,22 +131,26 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
|||
* a lapse of time, but until we reach a certain time.
|
||||
* This time is now plus the timeout.
|
||||
*/
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
clock_gettime(CLOCK_REALTIME, &ts_timeout);
|
||||
|
||||
/* Add our timeout to current time */
|
||||
ts_timeout.tv_nsec += (timeout % 1000) * 1000000;
|
||||
ts_timeout.tv_sec += timeout / 1000;
|
||||
#else
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
/* Add our timeout to current time */
|
||||
now.tv_usec += (timeout % 1000) * 1000;
|
||||
now.tv_sec += timeout / 1000;
|
||||
ts_timeout.tv_sec = now.tv_sec + (timeout / 1000);
|
||||
ts_timeout.tv_nsec = (now.tv_usec + (timeout % 1000) * 1000) * 1000;
|
||||
#endif
|
||||
|
||||
/* Wrap the second if needed */
|
||||
if ( now.tv_usec >= 1000000 ) {
|
||||
now.tv_usec -= 1000000;
|
||||
now.tv_sec ++;
|
||||
if (ts_timeout.tv_nsec > 1000000000) {
|
||||
ts_timeout.tv_sec += 1;
|
||||
ts_timeout.tv_nsec -= 1000000000;
|
||||
}
|
||||
|
||||
/* Convert to timespec */
|
||||
ts_timeout.tv_sec = now.tv_sec;
|
||||
ts_timeout.tv_nsec = now.tv_usec * 1000;
|
||||
|
||||
/* Wait. */
|
||||
do {
|
||||
retval = sem_timedwait(&sem->sem, &ts_timeout);
|
||||
|
|
@ -150,7 +160,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
|||
if (errno == ETIMEDOUT) {
|
||||
retval = SDL_MUTEX_TIMEDOUT;
|
||||
} else {
|
||||
SDL_SetError(strerror(errno));
|
||||
SDL_SetError("sem_timedwait returned an error: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "SDL_platform.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "../SDL_thread_c.h"
|
||||
#include "../SDL_systhread.h"
|
||||
#ifdef __ANDROID__
|
||||
|
|
@ -57,11 +58,13 @@
|
|||
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#ifndef __NACL__
|
||||
/* List of signals to mask in the subthreads */
|
||||
static const int sig_list[] = {
|
||||
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
|
||||
SIGVTALRM, SIGPROF, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
static void *
|
||||
RunThread(void *data)
|
||||
|
|
@ -84,6 +87,7 @@ int
|
|||
SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
||||
{
|
||||
pthread_attr_t type;
|
||||
const char *hint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);
|
||||
|
||||
/* do this here before any threads exist, so there's no race condition. */
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
|
|
@ -103,6 +107,14 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
|||
return SDL_SetError("Couldn't initialize pthread attributes");
|
||||
}
|
||||
pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
/* If the SDL_HINT_THREAD_STACK_SIZE exists and it seems to be a positive number, use it */
|
||||
if (hint && hint[0] >= '0' && hint[0] <= '9') {
|
||||
const size_t stacksize = (size_t) SDL_atoi(hint);
|
||||
if (stacksize > 0) {
|
||||
pthread_attr_setstacksize(&type, stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the thread and go! */
|
||||
if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
|
||||
|
|
@ -115,8 +127,10 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
|||
void
|
||||
SDL_SYS_SetupThread(const char *name)
|
||||
{
|
||||
#if !defined(__ANDROID__) && !defined(__NACL__)
|
||||
int i;
|
||||
sigset_t mask;
|
||||
#endif /* !__ANDROID__ && !__NACL__ */
|
||||
|
||||
if (name != NULL) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
|
|
@ -129,7 +143,11 @@ SDL_SYS_SetupThread(const char *name)
|
|||
#endif
|
||||
}
|
||||
#elif HAVE_PTHREAD_SETNAME_NP
|
||||
#if defined(__NETBSD__)
|
||||
pthread_setname_np(pthread_self(), "%s", name);
|
||||
#else
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
#endif
|
||||
#elif HAVE_PTHREAD_SET_NAME_NP
|
||||
pthread_set_name_np(pthread_self(), name);
|
||||
#elif defined(__HAIKU__)
|
||||
|
|
@ -141,12 +159,16 @@ SDL_SYS_SetupThread(const char *name)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* NativeClient does not yet support signals.*/
|
||||
#if !defined(__ANDROID__) && !defined(__NACL__)
|
||||
/* Mask asynchronous signals for this thread */
|
||||
sigemptyset(&mask);
|
||||
for (i = 0; sig_list[i]; ++i) {
|
||||
sigaddset(&mask, sig_list[i]);
|
||||
}
|
||||
pthread_sigmask(SIG_BLOCK, &mask, 0);
|
||||
#endif /* !__ANDROID__ && !__NACL__ */
|
||||
|
||||
|
||||
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
|
||||
/* Allow ourselves to be asynchronously cancelled */
|
||||
|
|
@ -166,7 +188,10 @@ SDL_ThreadID(void)
|
|||
int
|
||||
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
#if __NACL__
|
||||
/* FIXME: Setting thread priority does not seem to be supported in NACL */
|
||||
return 0;
|
||||
#elif __LINUX__
|
||||
int value;
|
||||
|
||||
if (priority == SDL_THREAD_PRIORITY_LOW) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -128,7 +128,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
|
|||
}
|
||||
|
||||
try {
|
||||
std::unique_lock<std::recursive_mutex> cpp_lock(mutex->cpp_mutex, std::defer_lock_t());
|
||||
std::unique_lock<std::recursive_mutex> cpp_lock(mutex->cpp_mutex, std::adopt_lock_t());
|
||||
if (ms == SDL_MUTEX_MAXWAIT) {
|
||||
cond->cpp_cond.wait(
|
||||
cpp_lock
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -45,7 +45,11 @@ SDL_CreateMutex(void)
|
|||
if (mutex) {
|
||||
/* Initialize */
|
||||
/* On SMP systems, a non-zero spin count generally helps performance */
|
||||
#if __WINRT__
|
||||
InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
|
||||
#else
|
||||
InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
|
||||
#endif
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -45,7 +45,11 @@ SDL_CreateSemaphore(Uint32 initial_value)
|
|||
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
|
||||
if (sem) {
|
||||
/* Create the semaphore, with max value 32K */
|
||||
#if __WINRT__
|
||||
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
|
||||
#else
|
||||
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
|
||||
#endif
|
||||
sem->count = initial_value;
|
||||
if (!sem->id) {
|
||||
SDL_SetError("Couldn't create semaphore");
|
||||
|
|
@ -86,7 +90,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
|||
} else {
|
||||
dwMilliseconds = (DWORD) timeout;
|
||||
}
|
||||
#if __WINRT__
|
||||
switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) {
|
||||
#else
|
||||
switch (WaitForSingleObject(sem->id, dwMilliseconds)) {
|
||||
#endif
|
||||
case WAIT_OBJECT_0:
|
||||
InterlockedDecrement(&sem->count);
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
@ -106,7 +106,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
|
|||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread)
|
||||
{
|
||||
#elif defined(__CYGWIN__)
|
||||
#elif defined(__CYGWIN__) || defined(__WINRT__)
|
||||
int
|
||||
SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
||||
{
|
||||
|
|
@ -230,7 +230,11 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
|||
void
|
||||
SDL_SYS_WaitThread(SDL_Thread * thread)
|
||||
{
|
||||
#if __WINRT__
|
||||
WaitForSingleObjectEx(thread->handle, INFINITE, FALSE);
|
||||
#else
|
||||
WaitForSingleObject(thread->handle, INFINITE);
|
||||
#endif
|
||||
CloseHandle(thread->handle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2016 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue