Rework lockfile= file lock handling
[fio.git] / mutex.h
CommitLineData
07739b57
JA
1#ifndef FIO_MUTEX_H
2#define FIO_MUTEX_H
3
4#include <pthread.h>
5
cdd18ad8 6struct fio_mutex {
07739b57
JA
7 pthread_mutex_t lock;
8 pthread_cond_t cond;
64d4d313 9 int value;
4d4e80f2 10 int waiters;
07739b57
JA
11};
12
d7df1d13
JA
13struct fio_rwlock {
14 pthread_rwlock_t lock;
15};
16
521da527
JA
17enum {
18 FIO_MUTEX_LOCKED = 0,
19 FIO_MUTEX_UNLOCKED = 1,
20};
21
cdd18ad8
JA
22extern struct fio_mutex *fio_mutex_init(int);
23extern void fio_mutex_remove(struct fio_mutex *);
d7df1d13 24extern void fio_mutex_up(struct fio_mutex *);
af4bab56 25extern void fio_mutex_down(struct fio_mutex *);
656b1393 26extern int fio_mutex_down_timeout(struct fio_mutex *, unsigned int);
9c5b5290 27
d7df1d13
JA
28extern void fio_rwlock_read(struct fio_rwlock *);
29extern void fio_rwlock_write(struct fio_rwlock *);
30extern void fio_rwlock_unlock(struct fio_rwlock *);
31extern struct fio_rwlock *fio_rwlock_init(void);
32extern void fio_rwlock_remove(struct fio_rwlock *);
4d4e80f2 33
07739b57 34#endif