16 lines
321 B
C
16 lines
321 B
C
#pragma once
|
|
|
|
#include "kernel/lib.h"
|
|
|
|
struct Spinlock
|
|
{
|
|
volatile uint32_t next_ticket;
|
|
volatile uint32_t serving;
|
|
uint32_t locking;
|
|
};
|
|
typedef struct Spinlock Spinlock;
|
|
|
|
void spinlock_init(Spinlock* lock);
|
|
void spinlock_acquire(Spinlock* lock);
|
|
void spinlock_release(Spinlock* lock);
|