summaryrefslogtreecommitdiff
path: root/tools/virtio/linux/spinlock.h
blob: 028e3cdcc5d303379f05904a9dddca08cdd37f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef SPINLOCK_H_STUB
#define SPINLOCK_H_STUB

#include <pthread.h>

typedef pthread_spinlock_t  spinlock_t;

static inline void spin_lock_init(spinlock_t *lock)
{
	int r = pthread_spin_init(lock, 0);
	assert(!r);
}

static inline void spin_lock(spinlock_t *lock)
{
	int ret = pthread_spin_lock(lock);
	assert(!ret);
}

static inline void spin_unlock(spinlock_t *lock)
{
	int ret = pthread_spin_unlock(lock);
	assert(!ret);
}

static inline void spin_lock_bh(spinlock_t *lock)
{
	spin_lock(lock);
}

static inline void spin_unlock_bh(spinlock_t *lock)
{
	spin_unlock(lock);
}

static inline void spin_lock_irq(spinlock_t *lock)
{
	spin_lock(lock);
}

static inline void spin_unlock_irq(spinlock_t *lock)
{
	spin_unlock(lock);
}

static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long f)
{
	spin_lock(lock);
}

static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long f)
{
	spin_unlock(lock);
}

#endif