mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-13 15:23:34 +00:00
Remove newlines from log messages
This commit is contained in:
committed by
Sam Lantinga
parent
17625e20df
commit
718034f5fa
@@ -60,13 +60,13 @@ ThreadFunc(void *data)
|
||||
SDL_ThreadPriority prio = SDL_THREAD_PRIORITY_NORMAL;
|
||||
|
||||
SDL_SetTLS(&tls, "baby thread", NULL);
|
||||
SDL_Log("Started thread %s: My thread id is %" SDL_PRIu64 ", thread data = %s\n",
|
||||
SDL_Log("Started thread %s: My thread id is %" SDL_PRIu64 ", thread data = %s",
|
||||
(char *)data, SDL_GetCurrentThreadID(), (const char *)SDL_GetTLS(&tls));
|
||||
while (SDL_GetAtomicInt(&alive)) {
|
||||
SDL_Log("Thread '%s' is alive!\n", (char *)data);
|
||||
SDL_Log("Thread '%s' is alive!", (char *)data);
|
||||
|
||||
if (testprio) {
|
||||
SDL_Log("SDL_SetCurrentThreadPriority(%s):%d\n", getprioritystr(prio), SDL_SetCurrentThreadPriority(prio));
|
||||
SDL_Log("SDL_SetCurrentThreadPriority(%s):%d", getprioritystr(prio), SDL_SetCurrentThreadPriority(prio));
|
||||
if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL) {
|
||||
prio = SDL_THREAD_PRIORITY_LOW;
|
||||
}
|
||||
@@ -74,14 +74,14 @@ ThreadFunc(void *data)
|
||||
|
||||
SDL_Delay(1 * 1000);
|
||||
}
|
||||
SDL_Log("Thread '%s' exiting!\n", (char *)data);
|
||||
SDL_Log("Thread '%s' exiting!", (char *)data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
killed(int sig)
|
||||
{
|
||||
SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n");
|
||||
SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit");
|
||||
SDL_Delay(5 * 1000);
|
||||
SDL_SetAtomicInt(&alive, 0);
|
||||
SDL_WaitThread(thread, NULL);
|
||||
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Load the SDL library */
|
||||
if (!SDL_Init(0)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -131,26 +131,26 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
SDL_SetTLS(&tls, "main thread", NULL);
|
||||
SDL_Log("Main thread data initially: %s\n", (const char *)SDL_GetTLS(&tls));
|
||||
SDL_Log("Main thread data initially: %s", (const char *)SDL_GetTLS(&tls));
|
||||
|
||||
SDL_SetAtomicInt(&alive, 1);
|
||||
thread = SDL_CreateThread(ThreadFunc, "One", "#1");
|
||||
if (!thread) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
SDL_Delay(5 * 1000);
|
||||
SDL_Log("Waiting for thread #1\n");
|
||||
SDL_Log("Waiting for thread #1");
|
||||
SDL_SetAtomicInt(&alive, 0);
|
||||
SDL_WaitThread(thread, NULL);
|
||||
|
||||
SDL_Log("Main thread data finally: %s\n", (const char *)SDL_GetTLS(&tls));
|
||||
SDL_Log("Main thread data finally: %s", (const char *)SDL_GetTLS(&tls));
|
||||
|
||||
SDL_SetAtomicInt(&alive, 1);
|
||||
(void)signal(SIGTERM, killed);
|
||||
thread = SDL_CreateThread(ThreadFunc, "Two", "#2");
|
||||
if (!thread) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
(void)raise(SIGTERM);
|
||||
|
||||
Reference in New Issue
Block a user