diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-18 21:39:29 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-18 21:39:29 +0200 |
| commit | da70596895d8135e08f8caac6978117697b4c021 (patch) | |
| tree | 2516785b5434df8453687f05dc8dd877438901ab /dev/Kernel/Sources/Semaphore.cxx | |
| parent | 005de79004c9d30e64bdee6e14e06f9d47d1f2ab (diff) | |
[REFACTOR]
Improved project structure.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/Sources/Semaphore.cxx')
| -rw-r--r-- | dev/Kernel/Sources/Semaphore.cxx | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/dev/Kernel/Sources/Semaphore.cxx b/dev/Kernel/Sources/Semaphore.cxx deleted file mode 100644 index c159240e..00000000 --- a/dev/Kernel/Sources/Semaphore.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include <KernelKit/ProcessScheduler.hxx> -#include <KernelKit/Semaphore.hxx> - -namespace Kernel -{ - bool Semaphore::Unlock() noexcept - { - if (fLockingProcess) - fLockingProcess = nullptr; - - return fLockingProcess == nullptr; - } - - bool Semaphore::Lock(PROCESS_HEADER_BLOCK* process) - { - if (!process || fLockingProcess) - return false; - - fLockingProcess = process; - - return true; - } - - bool Semaphore::IsLocked() const - { - return fLockingProcess; - } - - bool Semaphore::LockOrWait(PROCESS_HEADER_BLOCK* process, HardwareTimerInterface* timer) - { - if (process == nullptr) - return false; - - if (timer == nullptr) - return false; - - this->Lock(process); - - timer->Wait(); - - return this->Lock(process); - } - - /// @brief Wait with process, either wait for process being invalid, or not being run. - Void Semaphore::WaitForProcess() noexcept - { - while (fLockingProcess) - { - if (fLockingProcess->GetStatus() != ProcessStatus::kRunning) - { - this->Unlock(); - break; - } - } - } -} // namespace Kernel |
