diff --git a/src/thread/pthread/SDL_syscond.c b/src/thread/pthread/SDL_syscond.c index 04ccfee09d..9b94178d93 100644 --- a/src/thread/pthread/SDL_syscond.c +++ b/src/thread/pthread/SDL_syscond.c @@ -138,6 +138,10 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) default: retval = SDL_SetError("pthread_cond_timedwait() failed"); } +#if FAKE_RECURSIVE_MUTEX + mutex->owner = pthread_self(); + mutex->recursive = 0; +#endif return retval; } @@ -152,6 +156,10 @@ SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex) } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { return SDL_SetError("pthread_cond_wait() failed"); } +#if FAKE_RECURSIVE_MUTEX + mutex->owner = pthread_self(); + mutex->recursive = 0; +#endif return 0; } diff --git a/src/thread/pthread/SDL_sysmutex_c.h b/src/thread/pthread/SDL_sysmutex_c.h index bb0ed98033..ccc7c32110 100644 --- a/src/thread/pthread/SDL_sysmutex_c.h +++ b/src/thread/pthread/SDL_sysmutex_c.h @@ -23,9 +23,18 @@ #ifndef SDL_mutex_c_h_ #define SDL_mutex_c_h_ +#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \ + !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP +#define FAKE_RECURSIVE_MUTEX 1 +#endif + struct SDL_mutex { pthread_mutex_t id; +#if FAKE_RECURSIVE_MUTEX + int recursive; + pthread_t owner; +#endif }; #endif /* SDL_mutex_c_h_ */