diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-31 16:50:34 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-31 16:50:34 +0100 |
| commit | ad677bd1ed2c6d1a052d426117a4d20a0b59ac52 (patch) | |
| tree | 67898ad7cb935389619d8e9272cac9a732e24c92 /dev/Kernel/src/Semaphore.cc | |
| parent | 510c659355d9227d1b75edfe50c1b8691ea2f982 (diff) | |
FIX: CUSA and improved algorithm.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/src/Semaphore.cc')
| -rw-r--r-- | dev/Kernel/src/Semaphore.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/dev/Kernel/src/Semaphore.cc b/dev/Kernel/src/Semaphore.cc index 257fed48..b63d5be3 100644 --- a/dev/Kernel/src/Semaphore.cc +++ b/dev/Kernel/src/Semaphore.cc @@ -15,7 +15,7 @@ namespace Kernel Bool Semaphore::Unlock() noexcept { if (fLockingProcess) - fLockingProcess = nullptr; + fLockingProcess = UserThread(); else return No; @@ -25,7 +25,7 @@ namespace Kernel /***********************************************************************************/ /// @brief Locks process in the semaphore. /***********************************************************************************/ - Bool Semaphore::Lock(UserProcess* process) + Bool Semaphore::Lock(UserThread& process) { if (!process || fLockingProcess) return No; @@ -46,11 +46,8 @@ namespace Kernel /***********************************************************************************/ /// @brief Try lock or wait. /***********************************************************************************/ - Bool Semaphore::LockOrWait(UserProcess* process, TimerInterface* timer) + Bool Semaphore::LockOrWait(UserThread& process, TimerInterface* timer) { - if (process == nullptr) - return No; - if (timer == nullptr) return No; |
