Kill now unused lockfile_batch variable
[fio.git] / mutex.h
1 #ifndef FIO_MUTEX_H
2 #define FIO_MUTEX_H
3
4 #include <pthread.h>
5
6 struct fio_mutex {
7         pthread_mutex_t lock;
8         pthread_cond_t cond;
9         int value;
10         int waiters;
11 };
12
13 struct fio_rwlock {
14         pthread_rwlock_t lock;
15 };
16
17 enum {
18         FIO_MUTEX_LOCKED        = 0,
19         FIO_MUTEX_UNLOCKED      = 1,
20 };
21
22 extern struct fio_mutex *fio_mutex_init(int);
23 extern void fio_mutex_remove(struct fio_mutex *);
24 extern void fio_mutex_up(struct fio_mutex *);
25 extern void fio_mutex_down(struct fio_mutex *);
26 extern int fio_mutex_down_timeout(struct fio_mutex *, unsigned int);
27
28 extern void fio_rwlock_read(struct fio_rwlock *);
29 extern void fio_rwlock_write(struct fio_rwlock *);
30 extern void fio_rwlock_unlock(struct fio_rwlock *);
31 extern struct fio_rwlock *fio_rwlock_init(void);
32 extern void fio_rwlock_remove(struct fio_rwlock *);
33
34 #endif