SDL API renaming: SDL TLS functions

Fixes https://github.com/libsdl-org/SDL/issues/7743
This commit is contained in:
Sam Lantinga
2023-05-26 08:32:31 -07:00
parent 2a271aeaf1
commit cb73bed6eb
12 changed files with 92 additions and 52 deletions

View File

@@ -58,9 +58,9 @@ ThreadFunc(void *data)
{
SDL_ThreadPriority prio = SDL_THREAD_PRIORITY_NORMAL;
SDL_TLSSet(tls, "baby thread", NULL);
SDL_SetTLS(tls, "baby thread", NULL);
SDL_Log("Started thread %s: My thread id is %lu, thread data = %s\n",
(char *)data, SDL_ThreadID(), (const char *)SDL_TLSGet(tls));
(char *)data, SDL_ThreadID(), (const char *)SDL_GetTLS(tls));
while (alive) {
SDL_Log("Thread '%s' is alive!\n", (char *)data);
@@ -132,10 +132,10 @@ int main(int argc, char *argv[])
return 0;
}
tls = SDL_TLSCreate();
tls = SDL_CreateTLS();
SDL_assert(tls);
SDL_TLSSet(tls, "main thread", NULL);
SDL_Log("Main thread data initially: %s\n", (const char *)SDL_TLSGet(tls));
SDL_SetTLS(tls, "main thread", NULL);
SDL_Log("Main thread data initially: %s\n", (const char *)SDL_GetTLS(tls));
alive = 1;
thread = SDL_CreateThread(ThreadFunc, "One", "#1");
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
alive = 0;
SDL_WaitThread(thread, NULL);
SDL_Log("Main thread data finally: %s\n", (const char *)SDL_TLSGet(tls));
SDL_Log("Main thread data finally: %s\n", (const char *)SDL_GetTLS(tls));
alive = 1;
(void)signal(SIGTERM, killed);