summaryrefslogtreecommitdiff
path: root/mutex.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-12-18 19:44:18 -0700
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:58:10 -0800
commitc180342e1293259ca8d23ed0298aa6c32815fee5 (patch)
tree836d03507a0e73037d45a56a0f4709be3e36a7cd /mutex.c
parent32e9adb2bd331309c346fe3289e6a7adedaf9aa6 (diff)
downloadfio-c180342e1293259ca8d23ed0298aa6c32815fee5.tar.gz
mutex: add __fio_mutex_remove()
We have to remember to free the condvar, so add a __fio_mutex_remove() for cases that init a mutex inside an smalloc'ed region with __fio_mutex_init(). Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'mutex.c')
-rw-r--r--mutex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mutex.c b/mutex.c
index 9ee3bd83..53f9651a 100644
--- a/mutex.c
+++ b/mutex.c
@@ -18,10 +18,15 @@
#include "fio_time.h"
#include "gettime.h"
-void fio_mutex_remove(struct fio_mutex *mutex)
+void __fio_mutex_remove(struct fio_mutex *mutex)
{
assert(mutex->magic == FIO_MUTEX_MAGIC);
pthread_cond_destroy(&mutex->cond);
+}
+
+void fio_mutex_remove(struct fio_mutex *mutex)
+{
+ __fio_mutex_remove(mutex);
munmap((void *) mutex, sizeof(*mutex));
}