diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-06-02 00:26:57 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-06-02 00:26:57 +0200 |
commit | 45f420a338ea02225bb8a98c9aca5eed8d6a23ae (patch) | |
tree | 97fdb1c8e81ba79b101b928158e5e37fa938c8f3 /kernel/spinlock.h |
Initial commit
Diffstat (limited to 'kernel/spinlock.h')
-rw-r--r-- | kernel/spinlock.h | 15 |
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);
|