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
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)
327 if (thread ==
NULL) {
371 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
394 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
397 const char *name,
void *data,
398 pfnSDL_CurrentBeginThread pfnBeginThread,
399 pfnSDL_CurrentEndThread pfnEndThread)
403 const char *name,
void *data)
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