Add spinlock wrapper helpers
[fio.git] / spinlock.h
1 #ifndef FIO_SPINLOCK_H
2 #define FIO_SPINLOCK_H
3
4 struct fio_spinlock {
5         spinlock_t slock;
6         int lock_fd;
7 };
8
9 extern struct fio_spinlock *fio_spinlock_init(void);
10 extern void fio_spinlock_remove(struct fio_spinlock *);
11
12 static inline void fio_spin_lock(struct fio_spinlock *lock)
13 {
14         spin_lock(&lock->slock);
15 }
16
17 static inline void fio_spin_unlock(struct fio_spinlock *lock)
18 {
19         spin_unlock(&lock->slock);
20 }
21
22 #endif