summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-01 09:16:50 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-08-01 09:16:50 +0100
commit11ad9b56ccc1ed50c9293ee4771cf135f6b03c99 (patch)
treedb61e896e60acefaf5995c8c393772ad7a9ad443 /dev/kernel
parent55d4ff5b5d8ec106d9f42e27c5218911d7c47d83 (diff)
fix: KernelKit: fix BinaryMutex object, it used to took USER_PROCESS as reference with a explicit default constructor.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel')
-rw-r--r--dev/kernel/KernelKit/BinaryMutex.h8
-rw-r--r--dev/kernel/src/BinaryMutex.cc13
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();