From 9cd2e9ec8fc0127393dfce9c0359d500c8c238be Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 09 Apr 2019 02:22:50 +0000
Subject: [PATCH] updae source to 2.0.9 source
---
source/src/thread/pthread/SDL_sysmutex.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/source/src/thread/pthread/SDL_sysmutex.c b/source/src/thread/pthread/SDL_sysmutex.c
index e7b5b5c..e514778 100644
--- a/source/src/thread/pthread/SDL_sysmutex.c
+++ b/source/src/thread/pthread/SDL_sysmutex.c
@@ -116,6 +116,7 @@
SDL_TryLockMutex(SDL_mutex * mutex)
{
int retval;
+ int result;
#if FAKE_RECURSIVE_MUTEX
pthread_t this_thread;
#endif
@@ -134,18 +135,20 @@
We set the locking thread id after we obtain the lock
so unlocks from other threads will fail.
*/
- if (pthread_mutex_trylock(&mutex->id) == 0) {
+ result = pthread_mutex_trylock(&mutex->id);
+ if (result == 0) {
mutex->owner = this_thread;
mutex->recursive = 0;
- } else if (errno == EBUSY) {
+ } else if (result == EBUSY) {
retval = SDL_MUTEX_TIMEDOUT;
} else {
retval = SDL_SetError("pthread_mutex_trylock() failed");
}
}
#else
- if (pthread_mutex_trylock(&mutex->id) != 0) {
- if (errno == EBUSY) {
+ result = pthread_mutex_trylock(&mutex->id);
+ if (result != 0) {
+ if (result == EBUSY) {
retval = SDL_MUTEX_TIMEDOUT;
} else {
retval = SDL_SetError("pthread_mutex_trylock() failed");
--
Gitblit v1.9.3