From a13e1c0911c0627184bc38f18c7fdda64447b3ad Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 23 Mar 2025 19:13:48 +0100 Subject: meta(kernel): Reworked repository's filesystem structure. Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss --- dev/kernel/KernelKit/BinaryMutex.h | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 dev/kernel/KernelKit/BinaryMutex.h (limited to 'dev/kernel/KernelKit/BinaryMutex.h') diff --git a/dev/kernel/KernelKit/BinaryMutex.h b/dev/kernel/KernelKit/BinaryMutex.h new file mode 100644 index 00000000..21b2ca6d --- /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 +#include +#include + +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 -- cgit v1.2.3