summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/KernelKit
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel/KernelKit')
-rw-r--r--dev/Kernel/KernelKit/BinaryMutex.h43
-rw-r--r--dev/Kernel/KernelKit/Semaphore.h29
2 files changed, 44 insertions, 28 deletions
diff --git a/dev/Kernel/KernelKit/BinaryMutex.h b/dev/Kernel/KernelKit/BinaryMutex.h
new file mode 100644
index 00000000..a8e18abf
--- /dev/null
+++ b/dev/Kernel/KernelKit/BinaryMutex.h
@@ -0,0 +1,43 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Defines.h>
+#include <KernelKit/Timer.h>
+#include <CompilerKit/CompilerKit.h>
+
+namespace NeOS
+{
+ class UserProcess;
+
+ typedef UserProcess& UserProcessRef;
+
+ /// @brief Access control class, which locks a task until one is done.
+ class BinaryMutex final
+ {
+ public:
+ explicit BinaryMutex() = default;
+ ~BinaryMutex() = default;
+
+ public:
+ bool IsLocked() const;
+ bool Unlock() noexcept;
+
+ public:
+ BOOL WaitForProcess(const Int16& sec) noexcept;
+
+ public:
+ bool Lock(UserProcess& process);
+ bool LockOrWait(UserProcess& process, TimerInterface* timer);
+
+ public:
+ NE_COPY_DEFAULT(BinaryMutex);
+
+ private:
+ UserProcessRef fLockingProcess;
+ };
+} // namespace NeOS
diff --git a/dev/Kernel/KernelKit/Semaphore.h b/dev/Kernel/KernelKit/Semaphore.h
index 5d77b84d..f780872a 100644
--- a/dev/Kernel/KernelKit/Semaphore.h
+++ b/dev/Kernel/KernelKit/Semaphore.h
@@ -12,32 +12,5 @@
namespace NeOS
{
- class UserProcess;
- typedef UserProcess& UserProcessRef;
-
- /// @brief Access control class, which locks a task until one is done.
- class Semaphore final
- {
- public:
- explicit Semaphore() = default;
- ~Semaphore() = default;
-
- public:
- bool IsLocked() const;
- bool Unlock() noexcept;
-
- public:
- void WaitForProcess() noexcept;
-
- public:
- bool Lock(UserProcess& process);
- bool LockOrWait(UserProcess& process, TimerInterface* timer);
-
- public:
- NE_COPY_DEFAULT(Semaphore);
-
- private:
- UserProcessRef fLockingProcess;
- };
-} // namespace NeOS
+} // namespace NeOS \ No newline at end of file