Updated SDL_TLSID to use the same type as other IDs in SDL
parent
fc0c774976
commit
df4b855af5
|
@ -53,7 +53,7 @@ typedef struct SDL_Thread SDL_Thread;
|
||||||
typedef Uint64 SDL_ThreadID;
|
typedef Uint64 SDL_ThreadID;
|
||||||
|
|
||||||
/* Thread local storage ID, 0 is the invalid ID */
|
/* Thread local storage ID, 0 is the invalid ID */
|
||||||
typedef unsigned int SDL_TLSID;
|
typedef Uint32 SDL_TLSID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SDL thread priority.
|
* The SDL thread priority.
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
SDL_TLSID SDL_CreateTLS(void)
|
SDL_TLSID SDL_CreateTLS(void)
|
||||||
{
|
{
|
||||||
static SDL_AtomicInt SDL_tls_id;
|
static SDL_AtomicInt SDL_tls_id;
|
||||||
return SDL_AtomicIncRef(&SDL_tls_id) + 1;
|
return (SDL_TLSID)(SDL_AtomicIncRef(&SDL_tls_id) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *SDL_GetTLS(SDL_TLSID id)
|
void *SDL_GetTLS(SDL_TLSID id)
|
||||||
|
@ -60,6 +60,7 @@ int SDL_SetTLS(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *
|
||||||
newlimit = (id + TLS_ALLOC_CHUNKSIZE);
|
newlimit = (id + TLS_ALLOC_CHUNKSIZE);
|
||||||
new_storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage) + (newlimit - 1) * sizeof(storage->array[0]));
|
new_storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage) + (newlimit - 1) * sizeof(storage->array[0]));
|
||||||
if (!new_storage) {
|
if (!new_storage) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
storage = new_storage;
|
storage = new_storage;
|
||||||
|
|
|
@ -78,7 +78,7 @@ extern void SDL_RunThread(SDL_Thread *thread);
|
||||||
/* This is the system-independent thread local storage structure */
|
/* This is the system-independent thread local storage structure */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned int limit;
|
SDL_TLSID limit;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
|
|
Loading…
Reference in New Issue