mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-07 09:27:16 +02:00
Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
struct SDL_mutex
|
||||
{
|
||||
pthread_mutex_t id;
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
int recursive;
|
||||
pthread_t owner;
|
||||
#endif
|
||||
@@ -76,7 +76,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
|
||||
/* Lock the mutex */
|
||||
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
pthread_t this_thread;
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
this_thread = pthread_self();
|
||||
if (mutex->owner == this_thread) {
|
||||
++mutex->recursive;
|
||||
@@ -112,7 +112,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
{
|
||||
int retval;
|
||||
int result;
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
pthread_t this_thread;
|
||||
#endif
|
||||
|
||||
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
}
|
||||
|
||||
retval = 0;
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
this_thread = pthread_self();
|
||||
if (mutex->owner == this_thread) {
|
||||
++mutex->recursive;
|
||||
@@ -159,7 +159,7 @@ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doe
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FAKE_RECURSIVE_MUTEX
|
||||
#ifdef FAKE_RECURSIVE_MUTEX
|
||||
/* We can only unlock the mutex if we own it */
|
||||
if (pthread_self() == mutex->owner) {
|
||||
if (mutex->recursive) {
|
||||
|
||||
Reference in New Issue
Block a user