summaryrefslogtreecommitdiff
path: root/kernel/spinlock.h
blob: 5e9ac4095e155cbf9db9d9da8b2c2d9bb22fca4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#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);