Browse Source

Fix warning when NDEBUG macro is enabled.

tags/v2.5.2
Andrew Belt 6 months ago
parent
commit
befbb094a0
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      include/mutex.hpp

+ 4
- 0
include/mutex.hpp View File

@@ -18,6 +18,7 @@ struct SharedMutex {


SharedMutex() { SharedMutex() {
int err = pthread_rwlock_init(&rwlock, NULL); int err = pthread_rwlock_init(&rwlock, NULL);
(void) err;
assert(!err); assert(!err);
} }
~SharedMutex() { ~SharedMutex() {
@@ -26,6 +27,7 @@ struct SharedMutex {


void lock() { void lock() {
int err = pthread_rwlock_wrlock(&rwlock); int err = pthread_rwlock_wrlock(&rwlock);
(void) err;
assert(!err); assert(!err);
} }
/** Returns whether the lock was acquired. */ /** Returns whether the lock was acquired. */
@@ -34,11 +36,13 @@ struct SharedMutex {
} }
void unlock() { void unlock() {
int err = pthread_rwlock_unlock(&rwlock); int err = pthread_rwlock_unlock(&rwlock);
(void) err;
assert(!err); assert(!err);
} }


void lock_shared() { void lock_shared() {
int err = pthread_rwlock_rdlock(&rwlock); int err = pthread_rwlock_rdlock(&rwlock);
(void) err;
assert(!err); assert(!err);
} }
/** Returns whether the lock was acquired. */ /** Returns whether the lock was acquired. */


Loading…
Cancel
Save