mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 19:55:19 +00:00
Fixed some log related thread-safety warnings
This commit is contained in:
parent
f9d49358d2
commit
90756b542f
1 changed files with 12 additions and 0 deletions
|
|
@ -180,11 +180,15 @@ static void SDL_CheckInitLog(void)
|
|||
|
||||
static void CleanupLogPriorities(void)
|
||||
{
|
||||
SDL_LockMutex(SDL_log_lock);
|
||||
|
||||
while (SDL_loglevels) {
|
||||
SDL_LogLevel *entry = SDL_loglevels;
|
||||
SDL_loglevels = entry->next;
|
||||
SDL_free(entry);
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(SDL_log_lock);
|
||||
}
|
||||
|
||||
void SDL_SetLogPriorities(SDL_LogPriority priority)
|
||||
|
|
@ -339,6 +343,8 @@ static void ParseLogPriorities(const char *hint)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_LockMutex(SDL_log_lock);
|
||||
|
||||
for (name = hint; name; name = next) {
|
||||
const char *sep = SDL_strchr(name, '=');
|
||||
if (!sep) {
|
||||
|
|
@ -371,6 +377,8 @@ static void ParseLogPriorities(const char *hint)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(SDL_log_lock);
|
||||
}
|
||||
|
||||
void SDL_ResetLogPriorities(void)
|
||||
|
|
@ -431,12 +439,16 @@ void SDL_ResetLogPriorities(void)
|
|||
|
||||
static void CleanupLogPrefixes(void)
|
||||
{
|
||||
SDL_LockMutex(SDL_log_function_lock);
|
||||
|
||||
for (int i = 0; i < SDL_arraysize(SDL_priority_prefixes); ++i) {
|
||||
if (SDL_priority_prefixes[i]) {
|
||||
SDL_free(SDL_priority_prefixes[i]);
|
||||
SDL_priority_prefixes[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(SDL_log_function_lock);
|
||||
}
|
||||
|
||||
static const char *GetLogPriorityPrefix(SDL_LogPriority priority)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue