summaryrefslogtreecommitdiff
path: root/kernel/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/spinlock.h')
-rw-r--r--kernel/spinlock.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/spinlock.h b/kernel/spinlock.h
new file mode 100644
index 0000000..5e9ac40
--- /dev/null
+++ b/kernel/spinlock.h
@@ -0,0 +1,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);