summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/KernelKit/Semaphore.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-06 19:58:47 +0100
committerGitHub <noreply@github.com>2026-03-06 19:58:47 +0100
commit54340d14d5231c4756800a327b54ec285cb7662a (patch)
treedefe8133629446bbb463c34979c65ab87b0c35b2 /src/kernel/KernelKit/Semaphore.h
parent1e1a36c03e9c564f33d1a610f77c858bb7127f72 (diff)
parent55783c12c33d543ef0e504820de2931d1315253f (diff)
Merge pull request #125 from ne-foss-org/openhefs-filemgr-support
[FEAT] Implement OpenHeFS FileMgr, and semaphores API design rework.
Diffstat (limited to 'src/kernel/KernelKit/Semaphore.h')
-rw-r--r--src/kernel/KernelKit/Semaphore.h8
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;