spinlock: SPINLOCK_DEFINE

This commit is contained in:
Matheus
2024-10-05 11:31:35 -03:00
parent a8a40ac032
commit 8315d5642e
+2 -1
View File
@@ -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");