Unify spinlocks

This commit is contained in:
Imbus 2025-09-01 22:38:50 +02:00
parent c1a2c75054
commit 85ffed0c20
7 changed files with 56 additions and 59 deletions

View file

@ -48,4 +48,13 @@ void push_off(void);
/** @copydoc pop_off */
void pop_off(void);
typedef struct {
volatile uint32_t v; // 0 = unlocked, 1 = locked
} spinlock_t;
void spinlock_init(spinlock_t *l);
bool spin_trylock(spinlock_t *l);
void spin_unlock(spinlock_t *l);
void spin_lock(spinlock_t *l);
#endif