mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 15:32:22 +00:00
Kernel: Fix Lock racing to the WaitQueue
There was a time window between releasing Lock::m_lock and calling into the lock's WaitQueue where someone else could take m_lock and bring two threads into a deadlock situation. Fix this issue by holding Lock::m_lock until interrupts are disabled by either Thread::wait_on() or WaitQueue::wake_one().
This commit is contained in:
parent
61e6b1fb7c
commit
41376d4662
Notes:
sideshowbarker
2024-07-19 10:07:50 +09:00
Author: https://github.com/awesomekling
Commit: 41376d4662
5 changed files with 13 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
||||
|
@ -9,7 +10,7 @@ public:
|
|||
~WaitQueue();
|
||||
|
||||
void enqueue(Thread&);
|
||||
void wake_one();
|
||||
void wake_one(Atomic<bool>* lock = nullptr);
|
||||
void wake_all();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue