5#include "mos/platform/platform_defs.h"
10#define barrier() MOS_PLATFORM_MEMORY_BARRIER()
15#if MOS_DEBUG_FEATURE(spinlock)
21#define spinlock_init(lock) \
28#define SPINLOCK_INIT { 0 }
31#define _spinlock_real_acquire(lock) \
35 while (__atomic_test_and_set(&(lock)->flag, __ATOMIC_ACQUIRE)) \
39#define _spinlock_real_release(lock) \
42 __atomic_clear(&(lock)->flag, __ATOMIC_RELEASE); \
45#if MOS_DEBUG_FEATURE(spinlock)
46#define spinlock_acquire(lock) \
49 _spinlock_real_acquire(lock); \
50 (lock)->file = __FILE__; \
51 (lock)->line = __LINE__; \
53#define spinlock_release(lock) \
56 (lock)->file = NULL; \
58 _spinlock_real_release(lock); \
61#define spinlock_acquire(lock) _spinlock_real_acquire(lock)
62#define spinlock_release(lock) _spinlock_real_release(lock)
65#define spinlock_acquire_nodebug(lock) _spinlock_real_acquire(lock)
66#define spinlock_release_nodebug(lock) _spinlock_real_release(lock)
81#define RECURSIVE_SPINLOCK_INIT { SPINLOCK_INIT, NULL, 0 }
86 if (lock->
owner == owner)
100 if (lock->
owner == owner)
103 if (lock->
count == 0)
should_inline bool spinlock_is_locked(const spinlock_t *lock)
should_inline void recursive_spinlock_release(recursive_spinlock_t *lock, void *owner)
#define spinlock_acquire(lock)
should_inline bool recursive_spinlock_is_locked(recursive_spinlock_t *lock)
should_inline void recursive_spinlock_acquire(recursive_spinlock_t *lock, void *owner)
#define spinlock_release(lock)