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 130 if (!SDL_generic_TLS_mutex) {
133 if (!SDL_generic_TLS_mutex) {
136 SDL_generic_TLS_mutex =
mutex;
137 if (!SDL_generic_TLS_mutex) {
148 for (entry = SDL_generic_TLS; entry; entry = entry->
next) {
149 if (entry->
thread == thread) {
154 #if !SDL_THREADS_DISABLED 170 for (entry = SDL_generic_TLS; entry; entry = entry->
next) {
171 if (entry->
thread == thread) {
178 SDL_generic_TLS = entry->
next;
192 SDL_generic_TLS = entry;
218 if (!tls_errbuf && !tls_being_created) {
231 return &SDL_global_errbuf;
236 if (errbuf == ALLOCATION_IN_PROGRESS) {
237 return &SDL_global_errbuf;
245 return &SDL_global_errbuf;
268 void *userdata = args->
data;
270 int *statusloc = &
thread->status;
282 *statusloc = userfunc(userdata);
299 #ifdef SDL_CreateThread 300 #undef SDL_CreateThread 303 #define SDL_CreateThread SDL_CreateThread_REAL 306 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD 310 pfnSDL_CurrentBeginThread pfnBeginThread,
311 pfnSDL_CurrentEndThread pfnEndThread)
315 const char *name,
void *data)
324 if (thread ==
NULL) {
366 #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
SDL_TLSData * SDL_Generic_GetTLSData()
#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.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int SDL_SYS_SetTLSData(SDL_TLSData *data)
GLuint const GLchar * name
void SDL_DetachThread(SDL_Thread *thread)
#define SDL_InvalidParamError(param)
SDL_TLSData * SDL_SYS_GetTLSData()
#define SDL_MemoryBarrierAcquire()
struct SDL_TLSEntry * next
void SDL_SYS_WaitThread(SDL_Thread *thread)
GLsizei const GLfloat * value
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
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
struct SDL_TLSData::@26 array[1]
#define SDL_DestroySemaphore
void SDL_RunThread(void *data)
void SDL_SYS_SetupThread(const char *name)
const char * SDL_GetThreadName(SDL_Thread *thread)
void(* destructor)(void *)
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
unsigned long SDL_threadID