Commit | Line | Data |
---|---|---|
07739b57 JA |
1 | #ifndef FIO_MUTEX_H |
2 | #define FIO_MUTEX_H | |
3 | ||
4 | #include <pthread.h> | |
5 | ||
cdd18ad8 | 6 | struct fio_mutex { |
07739b57 JA |
7 | pthread_mutex_t lock; |
8 | pthread_cond_t cond; | |
64d4d313 | 9 | int value; |
07739b57 | 10 | |
cdd18ad8 | 11 | int mutex_fd; |
07739b57 JA |
12 | }; |
13 | ||
cdd18ad8 JA |
14 | extern struct fio_mutex *fio_mutex_init(int); |
15 | extern void fio_mutex_remove(struct fio_mutex *); | |
af4bab56 | 16 | extern void fio_mutex_down(struct fio_mutex *); |
64d4d313 JA |
17 | extern void fio_mutex_down_read(struct fio_mutex *); |
18 | extern void fio_mutex_down_write(struct fio_mutex *); | |
af4bab56 | 19 | extern void fio_mutex_up(struct fio_mutex *); |
64d4d313 JA |
20 | extern void fio_mutex_up_read(struct fio_mutex *); |
21 | extern void fio_mutex_up_write(struct fio_mutex *); | |
07739b57 | 22 | |
9c5b5290 JA |
23 | static inline struct fio_mutex *fio_mutex_rw_init(void) |
24 | { | |
25 | return fio_mutex_init(0); | |
26 | } | |
27 | ||
07739b57 | 28 | #endif |