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(); }