aboutsummaryrefslogtreecommitdiff
path: root/libs/kstd/src/mutex.cpp
diff options
context:
space:
mode:
authorLukas Oesch <lukas.oesch@ost.ch>2026-06-10 10:40:46 +0200
committerLukas Oesch <lukas.oesch@ost.ch>2026-06-10 10:40:46 +0200
commit33abd5cf264cb9e34121082105b0bc17b3cf7a36 (patch)
tree36b15d53fea04f4f9d9af817100f7ad013bd9b5c /libs/kstd/src/mutex.cpp
parentd01caf1c4aef3c89c68b9d1cc9fe56445f0860b5 (diff)
parent7e27130c342b7299a1d2188a7192a7f17b5ac2ad (diff)
downloadkernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.tar.xz
kernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.zip
Merge branch 'develop-BA-FS26' into 'develop'HEADdevelop
Merge of BA-FS26 branch into develop See merge request teachos/kernel!49
Diffstat (limited to 'libs/kstd/src/mutex.cpp')
-rw-r--r--libs/kstd/src/mutex.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/libs/kstd/src/mutex.cpp b/libs/kstd/src/mutex.cpp
deleted file mode 100644
index d66cb98..0000000
--- a/libs/kstd/src/mutex.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "kstd/mutex"
-
-#include "kstd/os/error.hpp"
-
-#include <atomic>
-
-namespace kstd
-{
-
- mutex::mutex() = default;
-
- mutex::~mutex()
- {
- if (m_locked.test(std::memory_order_relaxed))
- {
- os::panic("[KSTD] Tried to destroy a locked mutex.");
- }
- }
-
- auto mutex::lock() -> void
- {
- while (!try_lock())
- {
- asm volatile("nop");
- }
- }
-
- auto mutex::try_lock() -> bool
- {
- return !m_locked.test_and_set(std::memory_order_acquire);
- }
-
- auto mutex::unlock() -> void
- {
- m_locked.clear(std::memory_order_release);
- }
-
-} // namespace kstd