21 #include "../SDL_internal.h"
29 #include "../SDL_error_c.h"
45 if (!storage ||
id == 0 ||
id > storage->
limit) {
61 if (!storage || (
id > storage->
limit)) {
62 unsigned int i, oldlimit, newlimit;
64 oldlimit = storage ? storage->
limit : 0;
70 storage->
limit = newlimit;
71 for (
i = oldlimit;
i < newlimit; ++
i) {
93 for (
i = 0;
i < storage->
limit; ++
i) {
129 #if !SDL_THREADS_DISABLED
154 #if !SDL_THREADS_DISABLED
207 #if SDL_THREADS_DISABLED
210 return &SDL_global_error;
223 if (!tls_errbuf && !tls_being_created) {
236 return &SDL_global_errbuf;
241 if (errbuf == ALLOCATION_IN_PROGRESS) {
242 return &SDL_global_errbuf;
250 return &SDL_global_errbuf;
263 void *userdata =
thread->userdata;
266 int *statusloc = &
thread->status;
275 *statusloc = userfunc(userdata);
292 #ifdef SDL_CreateThread
293 #undef SDL_CreateThread
294 #undef SDL_CreateThreadWithStackSize
297 #define SDL_CreateThread SDL_CreateThread_REAL
298 #define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL
301 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
304 const char *
name,
const size_t stacksize,
void *
data,
310 const char *
name,
const size_t stacksize,
void *
data)
337 thread->stacksize = stacksize;
340 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
356 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
370 size_t stacksize = 0;
373 if (stackhint !=
NULL) {
376 if ((*stackhint !=
'\0') && (*endp ==
'\0')) {
378 stacksize = (
size_t) hintval;
383 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
392 const size_t stacksize,
void *
data) {
393 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
#define SDL_assert(condition)
#define SDL_MemoryBarrierRelease()
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
#define SDL_MemoryBarrierAcquire()
#define SDL_OutOfMemory()
#define SDL_InvalidParamError(param)
#define SDL_HINT_THREAD_STACK_SIZE
A string specifying SDL's threads stack size in bytes or "0" for the backend's default size.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint const GLchar * name
GLsizei const GLfloat * value
#define SDL_const_cast(type, expression)
int SDL_Generic_SetTLSData(SDL_TLSData *storage)
SDL_TLSID SDL_TLSCreate()
Create an identifier that is globally visible to all threads but refers to data that is thread-specif...
static SDL_TLSEntry * SDL_generic_TLS
void SDL_DetachThread(SDL_Thread *thread)
const char * SDL_GetThreadName(SDL_Thread *thread)
void SDL_RunThread(SDL_Thread *thread)
SDL_Thread * SDL_CreateThreadInternal(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
SDL_threadID SDL_GetThreadID(SDL_Thread *thread)
static SDL_mutex * SDL_generic_TLS_mutex
void * SDL_TLSGet(SDL_TLSID id)
Get the value associated with a thread local storage ID for the current thread.
static void SDL_TLSCleanup()
int SDL_SetThreadPriority(SDL_ThreadPriority priority)
void SDL_WaitThread(SDL_Thread *thread, int *status)
#define SDL_CreateThreadWithStackSize
SDL_error * SDL_GetErrBuf(void)
int SDL_TLSSet(SDL_TLSID id, const void *value, void(*destructor)(void *))
Set the value associated with a thread local storage ID for the current thread.
SDL_TLSData * SDL_Generic_GetTLSData(void)
void(__cdecl * pfnSDL_CurrentEndThread)(unsigned code)
unsigned long SDL_threadID
uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)(void *, unsigned, unsigned(__stdcall *func)(void *), void *, unsigned, unsigned *)
#define TLS_ALLOC_CHUNKSIZE
@ SDL_THREAD_STATE_ZOMBIE
@ SDL_THREAD_STATE_CLEANED
@ SDL_THREAD_STATE_DETACHED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
void SDL_SYS_SetupThread(const char *name)
int SDL_SYS_CreateThread(SDL_Thread *thread)
void SDL_SYS_DetachThread(SDL_Thread *thread)
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
void SDL_SYS_WaitThread(SDL_Thread *thread)
int SDL_SYS_SetTLSData(SDL_TLSData *data)
SDL_TLSData * SDL_SYS_GetTLSData(void)
struct SDL_TLSData::@46 array[1]
void(* destructor)(void *)
struct SDL_TLSEntry * next
A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...
typedef int(__stdcall *FARPROC)()