mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
spinlock: SPINLOCK_DEFINE
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
|
||||
typedef int spinlock_t;
|
||||
|
||||
#define SPINLOCK_INIT(x) x = 0;
|
||||
#define SPINLOCK_INIT_VALUE 0
|
||||
#define SPINLOCK_INIT(x) x = SPINLOCK_INIT_VALUE
|
||||
#define SPINLOCK_DEFINE(x) spinlock_t x = SPINLOCK_INIT_VALUE
|
||||
|
||||
static inline void spinlock_acquire(spinlock_t *lock){
|
||||
while(!__sync_bool_compare_and_swap(lock, 0, 1)) asm("pause");
|
||||
|
||||
Reference in New Issue
Block a user