Jens Axboe | 07739b5 | 2007-03-08 20:25:46 +0100 | [diff] [blame] | 1 | #ifndef FIO_MUTEX_H |
| 2 | #define FIO_MUTEX_H |
| 3 | |
| 4 | #include <pthread.h> |
| 5 | |
Jens Axboe | cdd18ad | 2008-02-27 18:58:00 +0100 | [diff] [blame^] | 6 | struct fio_mutex { |
Jens Axboe | 07739b5 | 2007-03-08 20:25:46 +0100 | [diff] [blame] | 7 | pthread_mutex_t lock; |
| 8 | pthread_cond_t cond; |
| 9 | unsigned int value; |
| 10 | |
Jens Axboe | cdd18ad | 2008-02-27 18:58:00 +0100 | [diff] [blame^] | 11 | int mutex_fd; |
Jens Axboe | 07739b5 | 2007-03-08 20:25:46 +0100 | [diff] [blame] | 12 | }; |
| 13 | |
Jens Axboe | cdd18ad | 2008-02-27 18:58:00 +0100 | [diff] [blame^] | 14 | extern struct fio_mutex *fio_mutex_init(int); |
| 15 | extern void fio_mutex_remove(struct fio_mutex *); |
| 16 | extern inline void fio_mutex_down(struct fio_mutex *); |
| 17 | extern inline void fio_mutex_up(struct fio_mutex *); |
Jens Axboe | 07739b5 | 2007-03-08 20:25:46 +0100 | [diff] [blame] | 18 | |
| 19 | #endif |