Add a real semaphore implemtation
[fio.git] / mutex.h
diff --git a/mutex.h b/mutex.h
new file mode 100644 (file)
index 0000000..483e5f4
--- /dev/null
+++ b/mutex.h
@@ -0,0 +1,19 @@
+#ifndef FIO_MUTEX_H
+#define FIO_MUTEX_H
+
+#include <pthread.h>
+
+struct fio_sem {
+       pthread_mutex_t lock;
+       pthread_cond_t cond;
+       unsigned int value;
+
+       char sem_name[32];
+};
+
+extern struct fio_sem *fio_sem_init(int);
+extern void fio_sem_remove(struct fio_sem *);
+extern inline void fio_sem_down(struct fio_sem *);
+extern inline void fio_sem_up(struct fio_sem *sem);
+
+#endif