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 131 if (!SDL_generic_TLS_mutex) {
134 if (!SDL_generic_TLS_mutex) {
137 SDL_generic_TLS_mutex =
mutex;
138 if (!SDL_generic_TLS_mutex) {
149 for (entry = SDL_generic_TLS; entry; entry = entry->
next) {
150 if (entry->
thread == thread) {
155 #if !SDL_THREADS_DISABLED 171 for (entry = SDL_generic_TLS; entry; entry = entry->
next) {
172 if (entry->
thread == thread) {
179 SDL_generic_TLS = entry->
next;
193 SDL_generic_TLS = entry;
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 304 #define SDL_CreateThread SDL_CreateThread_REAL 307 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD 310 const char *
name,
const size_t stacksize,
void *
data,
311 pfnSDL_CurrentBeginThread pfnBeginThread,
312 pfnSDL_CurrentEndThread pfnEndThread)
316 const char *name,
const size_t stacksize,
void *data)
325 if (thread ==
NULL) {
369 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD 392 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD 395 const char *name,
void *data,
396 pfnSDL_CurrentBeginThread pfnBeginThread,
397 pfnSDL_CurrentEndThread pfnEndThread)
401 const char *name,
void *data)
406 size_t stacksize = 0;
409 if (stackhint !=
NULL) {
412 if ((*stackhint !=
'\0') && (*endp ==
'\0')) {
414 stacksize = (
size_t) hintval;
419 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD 428 const size_t stacksize,
void *data) {
429 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
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.
#define SDL_const_cast(type, expression)
static SDL_mutex * SDL_generic_TLS_mutex
#define SDL_HINT_THREAD_STACK_SIZE
A string specifying SDL's threads stack size in bytes or "0" for the backend's default size...
struct SDL_TLSData::@33 array[1]
#define SDL_MemoryBarrierRelease()
A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...
#define TLS_ALLOC_CHUNKSIZE
int SDL_SetThreadPriority(SDL_ThreadPriority priority)
int SDL_Generic_SetTLSData(SDL_TLSData *storage)
#define SDL_CreateSemaphore
void * SDL_TLSGet(SDL_TLSID id)
Get the value associated with a thread local storage ID for the current thread.
SDL_TLSData * SDL_Generic_GetTLSData(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int SDL_SYS_SetTLSData(SDL_TLSData *data)
void SDL_DetachThread(SDL_Thread *thread)
#define SDL_InvalidParamError(param)
#define SDL_MemoryBarrierAcquire()
GLuint const GLchar * name
struct SDL_TLSEntry * next
void SDL_SYS_WaitThread(SDL_Thread *thread)
SDL_TLSData * SDL_SYS_GetTLSData(void)
void(* destructor)(void *)
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
GLsizei const GLfloat * value
void SDL_SYS_DetachThread(SDL_Thread *thread)
static void SDL_TLSCleanup()
SDL_error * SDL_GetErrBuf(void)
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
SDL_threadID SDL_GetThreadID(SDL_Thread *thread)
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)
#define SDL_assert(condition)
#define SDL_OutOfMemory()
void SDL_WaitThread(SDL_Thread *thread, int *status)
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
#define SDL_DestroySemaphore
void SDL_RunThread(void *data)
void SDL_SYS_SetupThread(const char *name)
static SDL_Thread * SDL_CreateThreadWithStackSize(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
const char * SDL_GetThreadName(SDL_Thread *thread)
SDL_Thread * SDL_CreateThreadInternal(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
unsigned long SDL_threadID