1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

Kernel: Lock should keep a reference to whoever holds the lock

Fixes a crash reported in #3990
This commit is contained in:
Tom 2020-11-29 17:09:14 -07:00 committed by Andreas Kling
parent 046d6855f5
commit 3bda458735
2 changed files with 2 additions and 2 deletions

View file

@ -72,7 +72,7 @@ private:
// the lock is unlocked, it just means we don't know which threads hold it. // the lock is unlocked, it just means we don't know which threads hold it.
// When locked exclusively, this is always the one thread that holds the // When locked exclusively, this is always the one thread that holds the
// lock. // lock.
Thread* m_holder { nullptr }; RefPtr<Thread> m_holder;
}; };
class Locker { class Locker {

View file

@ -311,7 +311,7 @@ bool Scheduler::donate_to(RefPtr<Thread>& beneficiary, const char* reason)
ASSERT(!proc.in_irq()); ASSERT(!proc.in_irq());
if (proc.in_critical() > 1) { if (proc.in_critical() > 1) {
scheduler_data.m_pending_beneficiary = *beneficiary; // Save the beneficiary scheduler_data.m_pending_beneficiary = beneficiary; // Save the beneficiary
scheduler_data.m_pending_donate_reason = reason; scheduler_data.m_pending_donate_reason = reason;
proc.invoke_scheduler_async(); proc.invoke_scheduler_async();
return false; return false;