diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-06 19:48:55 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-06 19:48:55 +0100 |
| commit | 94f0d53e6f57edb09541a3a7d67dd82a1f187a33 (patch) | |
| tree | 6849038374e7f5f570090bf108d1e656816eef91 /src/kernel/KernelKit | |
| parent | 1e1a36c03e9c564f33d1a610f77c858bb7127f72 (diff) | |
[FEAT] Implement OpenHeFS FileMgr, and semaphores API design rework.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/KernelKit')
| -rw-r--r-- | src/kernel/KernelKit/Semaphore.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kernel/KernelKit/Semaphore.h b/src/kernel/KernelKit/Semaphore.h index 3fe993b4..4dc8f388 100644 --- a/src/kernel/KernelKit/Semaphore.h +++ b/src/kernel/KernelKit/Semaphore.h @@ -27,7 +27,7 @@ namespace Kernel { using SemaphoreArr = UInt64[kSemaphoreCount]; /// @brief Checks if the semaphore is valid. -inline bool rtl_sem_is_valid(const SemaphoreArr& sem, UInt64 owner = 0) { +inline bool rtl_sem_is_valid(const SemaphoreArr& sem, const UInt64& owner = 0) { return sem[kSemaphoreOwnerIndex] == owner && sem[kSemaphoreCountIndex] > 0; } @@ -45,10 +45,10 @@ inline bool rtl_sem_release(SemaphoreArr& sem) { /// @param sem the semaphore array to use. /// @param owner the owner to set, could be anything identifitable. /// @return -inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64 owner) { +inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64& owner) { if (!owner) { err_global_get() = kErrorInvalidData; - return false; // Invalid owner + return false; // Invalid owner, return false and set KPC. } sem[kSemaphoreOwnerIndex] = owner; @@ -62,7 +62,7 @@ inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64 owner) { /// @param timeout /// @param condition condition pointer. /// @return -inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64 owner, const UInt64 timeout, +inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64& owner, const UInt64& timeout, bool& condition) { if (!rtl_sem_is_valid(sem, owner)) { return false; |
