Go to the documentation of this file.
21 #include "../SDL_internal.h"
30 #include "../SDL_error_c.h"
46 if (!storage ||
id == 0 ||
id > storage->
limit) {
62 if (!storage || (
id > storage->
limit)) {
63 unsigned int i, oldlimit, newlimit;
65 oldlimit = storage ? storage->
limit : 0;
71 storage->
limit = newlimit;
72 for (
i = oldlimit;
i < newlimit; ++
i) {
94 for (
i = 0;
i < storage->
limit; ++
i) {
130 #if !SDL_THREADS_DISABLED
155 #if !SDL_THREADS_DISABLED
219 if (!tls_errbuf && !tls_being_created) {
232 return &SDL_global_errbuf;
237 if (errbuf == ALLOCATION_IN_PROGRESS) {
238 return &SDL_global_errbuf;
246 return &SDL_global_errbuf;
269 void *userdata = args->
data;
271 int *statusloc = &
thread->status;
283 *statusloc = userfunc(userdata);
300 #ifdef SDL_CreateThread
301 #undef SDL_CreateThread
302 #undef SDL_CreateThreadWithStackSize
305 #define SDL_CreateThread SDL_CreateThread_REAL
306 #define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL
309 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
312 const char *
name,
const size_t stacksize,
void *
data,
313 pfnSDL_CurrentBeginThread pfnBeginThread,
314 pfnSDL_CurrentEndThread pfnEndThread)
318 const char *
name,
const size_t stacksize,
void *
data)
368 thread->stacksize = stacksize;
371 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
394 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
398 pfnSDL_CurrentBeginThread pfnBeginThread,
399 pfnSDL_CurrentEndThread pfnEndThread)
408 size_t stacksize = 0;
411 if (stackhint !=
NULL) {
414 if ((*stackhint !=
'\0') && (*endp ==
'\0')) {
416 stacksize = (
size_t) hintval;
421 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
430 const size_t stacksize,
void *
data) {
431 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
#define SDL_HINT_THREAD_STACK_SIZE
A string specifying SDL's threads stack size in bytes or "0" for the backend's default size.
@ SDL_THREAD_STATE_DETACHED
void SDL_DetachThread(SDL_Thread *thread)
int SDL_Generic_SetTLSData(SDL_TLSData *storage)
#define TLS_ALLOC_CHUNKSIZE
void(* destructor)(void *)
#define SDL_CreateSemaphore
void SDL_RunThread(void *data)
#define SDL_MemoryBarrierRelease()
#define SDL_const_cast(type, expression)
struct SDL_TLSData::@32 array[1]
void SDL_SYS_SetupThread(const char *name)
#define SDL_InvalidParamError(param)
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
void SDL_SYS_WaitThread(SDL_Thread *thread)
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
@ SDL_THREAD_STATE_CLEANED
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int SDL_SYS_SetTLSData(SDL_TLSData *data)
SDL_Thread * SDL_CreateThreadInternal(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
#define SDL_CreateThreadWithStackSize
GLuint const GLchar * name
SDL_error * SDL_GetErrBuf(void)
void SDL_SYS_DetachThread(SDL_Thread *thread)
SDL_TLSID SDL_TLSCreate()
Create an identifier that is globally visible to all threads but refers to data that is thread-specif...
SDL_TLSData * SDL_SYS_GetTLSData(void)
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
const char * SDL_GetThreadName(SDL_Thread *thread)
#define SDL_assert(condition)
#define SDL_OutOfMemory()
unsigned long SDL_threadID
GLsizei const GLfloat * value
#define SDL_MemoryBarrierAcquire()
A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...
SDL_TLSData * SDL_Generic_GetTLSData(void)
void SDL_WaitThread(SDL_Thread *thread, int *status)
#define SDL_DestroySemaphore
void * SDL_TLSGet(SDL_TLSID id)
Get the value associated with a thread local storage ID for the current thread.
struct SDL_TLSEntry * next
static void SDL_TLSCleanup()
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)
static SDL_mutex * SDL_generic_TLS_mutex
SDL_threadID SDL_GetThreadID(SDL_Thread *thread)
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.
int SDL_SetThreadPriority(SDL_ThreadPriority priority)
@ SDL_THREAD_STATE_ZOMBIE
static SDL_TLSEntry * SDL_generic_TLS