diff options
Diffstat (limited to 'dev/kernel')
| -rw-r--r-- | dev/kernel/KernelKit/BinaryMutex.h | 8 | ||||
| -rw-r--r-- | dev/kernel/src/BinaryMutex.cc | 13 |
2 files changed, 10 insertions, 11 deletions
diff --git a/dev/kernel/KernelKit/BinaryMutex.h b/dev/kernel/KernelKit/BinaryMutex.h index 45d4bd8d..4a192bdd 100644 --- a/dev/kernel/KernelKit/BinaryMutex.h +++ b/dev/kernel/KernelKit/BinaryMutex.h @@ -24,16 +24,16 @@ class BinaryMutex final { bool Unlock() noexcept; public: - BOOL WaitForProcess(const Int16& sec) noexcept; + BOOL WaitForProcess(const UInt32& sec) noexcept; public: - bool Lock(USER_PROCESS& process); - bool LockOrWait(USER_PROCESS& process, TimerInterface* timer); + bool Lock(USER_PROCESS* process); + bool LockOrWait(USER_PROCESS* process, TimerInterface* timer); public: NE_COPY_DEFAULT(BinaryMutex) private: - USER_PROCESS& fLockingProcess; + USER_PROCESS* fLockingProcess; }; } // namespace Kernel diff --git a/dev/kernel/src/BinaryMutex.cc b/dev/kernel/src/BinaryMutex.cc index 8c8cdc0f..f669d7fa 100644 --- a/dev/kernel/src/BinaryMutex.cc +++ b/dev/kernel/src/BinaryMutex.cc @@ -13,9 +13,8 @@ namespace Kernel { /***********************************************************************************/ Bool BinaryMutex::Unlock() noexcept { - if (fLockingProcess.Status == ProcessStatusKind::kRunning) { - fLockingProcess = USER_PROCESS(); - fLockingProcess.Status = ProcessStatusKind::kFrozen; + if (fLockingProcess->Status == ProcessStatusKind::kRunning) { + fLockingProcess = nullptr; return Yes; } @@ -27,7 +26,7 @@ Bool BinaryMutex::Unlock() noexcept { /// @brief Locks process in the binary mutex. /***********************************************************************************/ -Bool BinaryMutex::Lock(USER_PROCESS& process) { +Bool BinaryMutex::Lock(USER_PROCESS* process) { if (!process || this->IsLocked()) return No; this->fLockingProcess = process; @@ -40,14 +39,14 @@ Bool BinaryMutex::Lock(USER_PROCESS& process) { /***********************************************************************************/ Bool BinaryMutex::IsLocked() const { - return this->fLockingProcess.Status == ProcessStatusKind::kRunning; + return this->fLockingProcess->Status == ProcessStatusKind::kRunning; } /***********************************************************************************/ /// @brief Try lock or wait. /***********************************************************************************/ -Bool BinaryMutex::LockOrWait(USER_PROCESS& process, TimerInterface* timer) { +Bool BinaryMutex::LockOrWait(USER_PROCESS* process, TimerInterface* timer) { if (timer == nullptr) return No; this->Lock(process); @@ -62,7 +61,7 @@ Bool BinaryMutex::LockOrWait(USER_PROCESS& process, TimerInterface* timer) { /// @param sec seconds. /***********************************************************************************/ -BOOL BinaryMutex::WaitForProcess(const Int16& sec) noexcept { +BOOL BinaryMutex::WaitForProcess(const UInt32& sec) noexcept { HardwareTimer hw_timer(rtl_milliseconds(sec)); hw_timer.Wait(); |
