t/zbd/test-zbd-support: Report a test summary when finished
[fio.git] / fio_sem.h
CommitLineData
971caeb1
BVA
1#ifndef FIO_SEM_H
2#define FIO_SEM_H
3
4#include <pthread.h>
5#include "lib/types.h"
6
7#define FIO_SEM_MAGIC 0x4d555445U
8
9struct fio_sem {
10 pthread_mutex_t lock;
11 pthread_cond_t cond;
12 int value;
13 int waiters;
14 int magic;
15};
16
17enum {
18 FIO_SEM_LOCKED = 0,
19 FIO_SEM_UNLOCKED = 1,
20};
21
22extern int __fio_sem_init(struct fio_sem *, int);
23extern struct fio_sem *fio_sem_init(int);
24extern void __fio_sem_remove(struct fio_sem *);
25extern void fio_sem_remove(struct fio_sem *);
26extern void fio_sem_up(struct fio_sem *);
27extern void fio_sem_down(struct fio_sem *);
28extern bool fio_sem_down_trylock(struct fio_sem *);
29extern int fio_sem_down_timeout(struct fio_sem *, unsigned int);
30
31#endif