summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/KernelKit/BinaryMutex.h
diff options
context:
space:
mode:
authorzer0condition <apoyhome6@gmail.com>2026-03-22 19:56:35 +0530
committerzer0condition <apoyhome6@gmail.com>2026-03-22 19:56:35 +0530
commitaa548ba47347a67ff64a38dc842f9d0d5d6bf364 (patch)
tree5f33ff87cb06410eaf8ea741fc4ddd49ab821194 /src/kernel/KernelKit/BinaryMutex.h
parent5d11c45b45862ca86e0aee392885e7e6d8d66bfb (diff)
[KernelKit] scheduler sleep tracking + mutex priority inheritance
- add STime field to UserProcess for tracking sleep/blocked time - boost PTime proportionally when process wakes from sleep (interactive boost) - implement priority inheritance in BinaryMutex to prevent priority inversion - fix broken Unlock() that was spinning waiting for process status change - fix LockAndWait() that was locking then immediately unlocking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/kernel/KernelKit/BinaryMutex.h')
-rw-r--r--src/kernel/KernelKit/BinaryMutex.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kernel/KernelKit/BinaryMutex.h b/src/kernel/KernelKit/BinaryMutex.h
index 2fb390d3..d97ab854 100644
--- a/src/kernel/KernelKit/BinaryMutex.h
+++ b/src/kernel/KernelKit/BinaryMutex.h
@@ -8,12 +8,14 @@
#include <CompilerKit/CompilerKit.h>
#include <KernelKit/Timer.h>
+#include <KernelKit/CoreProcessScheduler.h>
#include <NeKit/Config.h>
namespace Kernel {
class UserProcess;
/// @brief Access control class, which locks a task until one is done.
+/// Implements priority inheritance to prevent priority inversion.
class BinaryMutex final {
public:
using LockedPtr = UserProcess*;
@@ -37,6 +39,7 @@ class BinaryMutex final {
private:
LockedPtr fLockingProcess{nullptr};
+ AffinityKind fOwnerOriginalAffinity{AffinityKind::kInvalid}; // for priority inheritance
};
} // namespace Kernel