aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/pthread/jmutex.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-12-02 22:21:58 +0100
committerPerttu Ahola <celeron55@gmail.com>2013-12-03 17:50:00 +0200
commit5004f31575c52b59e1fc654dfa08336a692afeee (patch)
tree6b44e7a6a964ce372b968feba3688518a0647010 /src/jthread/pthread/jmutex.cpp
parent6cbd1b8bf739e0d776ee508708b5076b491fb638 (diff)
downloadminetest-5004f31575c52b59e1fc654dfa08336a692afeee.tar.gz
minetest-5004f31575c52b59e1fc654dfa08336a692afeee.tar.bz2
minetest-5004f31575c52b59e1fc654dfa08336a692afeee.zip
Fix broken async locking in release build
Diffstat (limited to 'src/jthread/pthread/jmutex.cpp')
-rw-r--r--src/jthread/pthread/jmutex.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/jthread/pthread/jmutex.cpp b/src/jthread/pthread/jmutex.cpp
index bcc3853d2..0551b9728 100644
--- a/src/jthread/pthread/jmutex.cpp
+++ b/src/jthread/pthread/jmutex.cpp
@@ -26,25 +26,33 @@
*/
#include <assert.h>
#include "jthread/jmutex.h"
-
+#define UNUSED(expr) do { (void)(expr); } while (0)
JMutex::JMutex()
{
- assert(pthread_mutex_init(&mutex,NULL) == 0);
+ int mutex_init_retval = pthread_mutex_init(&mutex,NULL);
+ assert( mutex_init_retval == 0 );
+ UNUSED(mutex_init_retval);
}
JMutex::~JMutex()
{
- assert(pthread_mutex_destroy(&mutex) == 0);
+ int mutex_dextroy_retval = pthread_mutex_destroy(&mutex);
+ assert( mutex_dextroy_retval == 0 );
+ UNUSED(mutex_dextroy_retval);
}
int JMutex::Lock()
{
- assert(pthread_mutex_lock(&mutex) == 0);
- return 0;
+ int mutex_lock_retval = pthread_mutex_lock(&mutex);
+ assert( mutex_lock_retval == 0 );
+ return mutex_lock_retval;
+ UNUSED(mutex_lock_retval);
}
int JMutex::Unlock()
{
- assert(pthread_mutex_unlock(&mutex) == 0);
- return 0;
+ int mutex_unlock_retval = pthread_mutex_unlock(&mutex);
+ assert( mutex_unlock_retval == 0 );
+ return mutex_unlock_retval;
+ UNUSED(mutex_unlock_retval);
}