diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c index 8fa687140f..88a536a1c5 100644 --- a/src/core/linux/SDL_threadprio.c +++ b/src/core/linux/SDL_threadprio.c @@ -22,7 +22,7 @@ #ifdef __LINUX__ -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED #include #include #include @@ -251,7 +251,7 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { @@ -283,7 +283,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else int osPriority; diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index e55dfd7fc7..9cab60d212 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -551,7 +551,7 @@ int SDL_StartEventLoop(void) */ /* Create the lock and set ourselves active */ -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); if (SDL_EventQ.lock == NULL) { diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 0fa11f0241..75f7f5cc6d 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -120,7 +120,7 @@ SDL_Generic_GetTLSData(void) SDL_TLSEntry *entry; SDL_TLSData *storage = NULL; -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (SDL_generic_TLS_mutex == NULL) { static SDL_SpinLock tls_lock; SDL_AtomicLock(&tls_lock); @@ -145,7 +145,7 @@ SDL_Generic_GetTLSData(void) break; } } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(SDL_generic_TLS_mutex); #endif @@ -203,7 +203,7 @@ static SDL_error *SDL_GetStaticErrBuf(void) return &SDL_global_error; } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED static void SDLCALL SDL_FreeErrBuf(void *data) { SDL_error *errbuf = (SDL_error *)data; @@ -219,7 +219,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data) SDL_error * SDL_GetErrBuf(void) { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return SDL_GetStaticErrBuf(); #else static SDL_SpinLock tls_lock; diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 601e1a5b47..20f9257283 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -24,7 +24,7 @@ #define SDL_thread_c_h_ /* Need the definitions of SYS_ThreadHandle */ -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) #include "generic/SDL_systhread_c.h" #elif SDL_THREAD_PTHREAD #include "pthread/SDL_systhread_c.h" diff --git a/src/thread/generic/SDL_sysmutex.c b/src/thread/generic/SDL_sysmutex.c index dc2f64e0e7..62489b0e0e 100644 --- a/src/thread/generic/SDL_sysmutex.c +++ b/src/thread/generic/SDL_sysmutex.c @@ -40,7 +40,7 @@ SDL_CreateMutex(void) /* Allocate mutex memory */ mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (mutex) { /* Create the mutex semaphore, with initial value 1 */ mutex->sem = SDL_CreateSemaphore(1); @@ -72,7 +72,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 SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SDL_threadID this_thread; @@ -101,7 +101,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* try Lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else int retval = 0; @@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else if (mutex == NULL) { diff --git a/src/thread/generic/SDL_syssem.c b/src/thread/generic/SDL_syssem.c index 147a17e489..933183c646 100644 --- a/src/thread/generic/SDL_syssem.c +++ b/src/thread/generic/SDL_syssem.c @@ -24,7 +24,7 @@ #include "SDL_systhread_c.h" -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) SDL_sem * SDL_CreateSemaphore(Uint32 initial_value) diff --git a/src/thread/psp/SDL_sysmutex.c b/src/thread/psp/SDL_sysmutex.c index 19df56d458..c5806ec3c7 100644 --- a/src/thread/psp/SDL_sysmutex.c +++ b/src/thread/psp/SDL_sysmutex.c @@ -75,7 +75,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 SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; @@ -96,7 +96,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; @@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; diff --git a/src/thread/vita/SDL_sysmutex.c b/src/thread/vita/SDL_sysmutex.c index bfa930d591..56a002344b 100644 --- a/src/thread/vita/SDL_sysmutex.c +++ b/src/thread/vita/SDL_sysmutex.c @@ -71,7 +71,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 SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; @@ -92,7 +92,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; @@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) return 0; #else SceInt32 res = 0; diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index 6b7c8d5cf5..15840c3898 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -25,7 +25,7 @@ /* #define DEBUG_TIMERS */ -#if !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED +#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED) typedef struct SDL_Timer { diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c index 5557048b75..d49ef94d88 100644 --- a/src/video/wayland/SDL_waylanddatamanager.c +++ b/src/video/wayland/SDL_waylanddatamanager.c @@ -54,7 +54,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigemptyset(&sig_set); sigaddset(&sig_set, SIGPIPE); -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set); #else pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); @@ -76,7 +76,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigtimedwait(&sig_set, 0, &zerotime); -#if SDL_THREADS_DISABLED +#if defined(SDL_THREADS_DISABLED) sigprocmask(SIG_SETMASK, &old_sig_set, NULL); #else pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);