summaryrefslogtreecommitdiff
path: root/include/kernel/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/kernel/spinlock.h')
-rw-r--r--include/kernel/spinlock.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/kernel/spinlock.h b/include/kernel/spinlock.h
new file mode 100644
index 0000000..aec4b6a
--- /dev/null
+++ b/include/kernel/spinlock.h
@@ -0,0 +1,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();
+} \ No newline at end of file