mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 19:28:48 +00:00
Thread: Fix a regression introduced in 80a6df9022
Accidentally forgot to check the state parameter, which made this rather useless. Bug found, and cause identified by Andreas
This commit is contained in:
parent
53262cd08b
commit
4547a301c4
Notes:
sideshowbarker
2024-07-19 13:08:21 +09:00
Author: https://github.com/rburchell
Commit: 4547a301c4
Pull-request: https://github.com/SerenityOS/serenity/pull/345
1 changed files with 7 additions and 2 deletions
|
@ -312,9 +312,14 @@ template<typename Callback>
|
||||||
inline IterationDecision Thread::for_each_in_state(State state, Callback callback)
|
inline IterationDecision Thread::for_each_in_state(State state, Callback callback)
|
||||||
{
|
{
|
||||||
ASSERT_INTERRUPTS_DISABLED();
|
ASSERT_INTERRUPTS_DISABLED();
|
||||||
|
auto new_callback = [=](Thread& thread) -> IterationDecision {
|
||||||
|
if (thread.state() == state)
|
||||||
|
return callback(thread);
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
};
|
||||||
if (is_runnable_state(state))
|
if (is_runnable_state(state))
|
||||||
return for_each_runnable(callback);
|
return for_each_runnable(new_callback);
|
||||||
return for_each_nonrunnable(callback);
|
return for_each_nonrunnable(new_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue