summaryrefslogtreecommitdiff
path: root/include/kernel/spinlock.h
blob: aec4b6a97b8eaceb1297d0d3da96cd548bd7a8c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once
#include "common/types.h"

struct spinlock
{
    uint locked;

    char *name;
    int cpu_id;
};

namespace Spinlock
{
    void init(struct spinlock *lk, char *name);
    void acquire(struct spinlock *lk);
    void release(struct spinlock *lk);
    int holding(struct spinlock *lk);
    void push_off();
    void pop_off();
}