Renamed SDL_ThreadID() to SDL_GetCurrentThreadID()

Also renamed SDL_threadID to SDL_ThreadID and made it Uint64 for consistency with other ID types
This commit is contained in:
Sam Lantinga
2024-01-18 04:57:12 -08:00
parent d6a41f8f31
commit fc0c774976
32 changed files with 100 additions and 83 deletions

View File

@@ -27,7 +27,7 @@
struct SDL_Mutex
{
int recursive;
SDL_threadID owner;
SDL_ThreadID owner;
SDL_Semaphore *sem;
};
@@ -65,7 +65,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
{
#ifndef SDL_THREADS_DISABLED
if (mutex != NULL) {
SDL_threadID this_thread = SDL_ThreadID();
SDL_ThreadID this_thread = SDL_GetCurrentThreadID();
if (mutex->owner == this_thread) {
++mutex->recursive;
} else {
@@ -86,7 +86,7 @@ int SDL_TryLockMutex(SDL_Mutex *mutex)
int retval = 0;
#ifndef SDL_THREADS_DISABLED
if (mutex) {
SDL_threadID this_thread = SDL_ThreadID();
SDL_ThreadID this_thread = SDL_GetCurrentThreadID();
if (mutex->owner == this_thread) {
++mutex->recursive;
} else {
@@ -110,7 +110,7 @@ void SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang d
#ifndef SDL_THREADS_DISABLED
if (mutex != NULL) {
// If we don't own the mutex, we can't unlock it
if (SDL_ThreadID() != mutex->owner) {
if (SDL_GetCurrentThreadID() != mutex->owner) {
SDL_assert(!"Tried to unlock a mutex we don't own!");
return; // (undefined behavior!) SDL_SetError("mutex not owned by this thread");
}