1 #ifndef SPINLOCK_H_STUB
2 #define SPINLOCK_H_STUB
3 
4 #include <pthread.h>
5 
6 typedef pthread_spinlock_t  spinlock_t;
7 
spin_lock_init(spinlock_t * lock)8 static inline void spin_lock_init(spinlock_t *lock)
9 {
10 	int r = pthread_spin_init(lock, 0);
11 	assert(!r);
12 }
13 
spin_lock(spinlock_t * lock)14 static inline void spin_lock(spinlock_t *lock)
15 {
16 	int ret = pthread_spin_lock(lock);
17 	assert(!ret);
18 }
19 
spin_unlock(spinlock_t * lock)20 static inline void spin_unlock(spinlock_t *lock)
21 {
22 	int ret = pthread_spin_unlock(lock);
23 	assert(!ret);
24 }
25 
spin_lock_bh(spinlock_t * lock)26 static inline void spin_lock_bh(spinlock_t *lock)
27 {
28 	spin_lock(lock);
29 }
30 
spin_unlock_bh(spinlock_t * lock)31 static inline void spin_unlock_bh(spinlock_t *lock)
32 {
33 	spin_unlock(lock);
34 }
35 
spin_lock_irq(spinlock_t * lock)36 static inline void spin_lock_irq(spinlock_t *lock)
37 {
38 	spin_lock(lock);
39 }
40 
spin_unlock_irq(spinlock_t * lock)41 static inline void spin_unlock_irq(spinlock_t *lock)
42 {
43 	spin_unlock(lock);
44 }
45 
spin_lock_irqsave(spinlock_t * lock,unsigned long f)46 static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long f)
47 {
48 	spin_lock(lock);
49 }
50 
spin_unlock_irqrestore(spinlock_t * lock,unsigned long f)51 static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long f)
52 {
53 	spin_unlock(lock);
54 }
55 
56 #endif
57