X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=mutex.h;h=7be0ab1b44b7c96fa4d7be645a9ff95cc9e8a0bb;hp=85f5f69cee0724069d60d72d9761e2cfc19efccd;hb=b0f65863844b4de92d10fefaabde80ea5bc3e5cc;hpb=cdd18ad87ed9a3639b76c41cfc9682ad7cce652e diff --git a/mutex.h b/mutex.h index 85f5f69c..7be0ab1b 100644 --- a/mutex.h +++ b/mutex.h @@ -6,14 +6,29 @@ struct fio_mutex { pthread_mutex_t lock; pthread_cond_t cond; - unsigned int value; + int value; + int waiters; int mutex_fd; }; extern struct fio_mutex *fio_mutex_init(int); extern void fio_mutex_remove(struct fio_mutex *); -extern inline void fio_mutex_down(struct fio_mutex *); -extern inline void fio_mutex_up(struct fio_mutex *); +extern void fio_mutex_down(struct fio_mutex *); +extern void fio_mutex_down_read(struct fio_mutex *); +extern void fio_mutex_down_write(struct fio_mutex *); +extern void fio_mutex_up(struct fio_mutex *); +extern void fio_mutex_up_read(struct fio_mutex *); +extern void fio_mutex_up_write(struct fio_mutex *); + +static inline struct fio_mutex *fio_mutex_rw_init(void) +{ + return fio_mutex_init(0); +} + +static inline int fio_mutex_getval(struct fio_mutex *mutex) +{ + return mutex->value; +} #endif