aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/pthread/jsemaphore.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/jsemaphore.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/jsemaphore.cpp')
-rw-r--r--src/jthread/pthread/jsemaphore.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/jthread/pthread/jsemaphore.cpp b/src/jthread/pthread/jsemaphore.cpp
index 31bf39466..962b582f1 100644
--- a/src/jthread/pthread/jsemaphore.cpp
+++ b/src/jthread/pthread/jsemaphore.cpp
@@ -18,25 +18,35 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include <assert.h>
#include "jthread/jsemaphore.h"
-
+#define UNUSED(expr) do { (void)(expr); } while (0)
JSemaphore::JSemaphore() {
- assert(sem_init(&m_semaphore,0,0) == 0);
+ int sem_init_retval = sem_init(&m_semaphore,0,0);
+ assert(sem_init_retval == 0);
+ UNUSED(sem_init_retval);
}
JSemaphore::~JSemaphore() {
- assert(sem_destroy(&m_semaphore) == 0);
+ int sem_destroy_retval = sem_destroy(&m_semaphore);
+ assert(sem_destroy_retval == 0);
+ UNUSED(sem_destroy_retval);
}
JSemaphore::JSemaphore(int initval) {
- assert(sem_init(&m_semaphore,0,initval) == 0);
+ int sem_init_retval = sem_init(&m_semaphore,0,initval);
+ assert(sem_init_retval == 0);
+ UNUSED(sem_init_retval);
}
void JSemaphore::Post() {
- assert(sem_post(&m_semaphore) == 0);
+ int sem_post_retval = sem_post(&m_semaphore);
+ assert(sem_post_retval == 0);
+ UNUSED(sem_post_retval);
}
void JSemaphore::Wait() {
- assert(sem_wait(&m_semaphore) == 0);
+ int sem_wait_retval = sem_wait(&m_semaphore);
+ assert(sem_wait_retval == 0);
+ UNUSED(sem_wait_retval);
}
int JSemaphore::GetValue() {