Windows: add missing files needed for msi build
[fio.git] / mutex.h
... / ...
CommitLineData
1#ifndef FIO_MUTEX_H
2#define FIO_MUTEX_H
3
4#include <pthread.h>
5
6struct fio_mutex {
7 pthread_mutex_t lock;
8 pthread_cond_t cond;
9 int value;
10 int waiters;
11
12 int mutex_fd;
13};
14
15extern struct fio_mutex *fio_mutex_init(int);
16extern void fio_mutex_remove(struct fio_mutex *);
17extern void fio_mutex_down(struct fio_mutex *);
18extern int fio_mutex_down_timeout(struct fio_mutex *, unsigned int);
19extern void fio_mutex_down_read(struct fio_mutex *);
20extern void fio_mutex_down_write(struct fio_mutex *);
21extern void fio_mutex_up(struct fio_mutex *);
22extern void fio_mutex_up_read(struct fio_mutex *);
23extern void fio_mutex_up_write(struct fio_mutex *);
24
25static inline struct fio_mutex *fio_mutex_rw_init(void)
26{
27 return fio_mutex_init(0);
28}
29
30static inline int fio_mutex_getval(struct fio_mutex *mutex)
31{
32 return mutex->value;
33}
34
35#endif