mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +00:00
Kernel: Implement FUTEX_WAKE of arbitrary count.
Previously we just woke all waiters no matter how many were requested. Fix this by implementing WaitQueue::wake_n(..).
This commit is contained in:
committed by
Andreas Kling
parent
e8f6f655bf
commit
1f64e3eb16
@@ -55,6 +55,21 @@ void WaitQueue::wake_one(Atomic<bool>* lock)
|
||||
Scheduler::stop_idling();
|
||||
}
|
||||
|
||||
void WaitQueue::wake_n(i32 wake_count)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
if (m_threads.is_empty())
|
||||
return;
|
||||
|
||||
for (i32 i = 0; i < wake_count; ++i) {
|
||||
Thread* thread = m_threads.take_first();
|
||||
if (!thread)
|
||||
break;
|
||||
thread->wake_from_queue();
|
||||
}
|
||||
Scheduler::stop_idling();
|
||||
}
|
||||
|
||||
void WaitQueue::wake_all()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
|
||||
Reference in New Issue
Block a user