mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +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
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)
|
||||
{
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
auto new_callback = [=](Thread& thread) -> IterationDecision {
|
||||
if (thread.state() == state)
|
||||
return callback(thread);
|
||||
return IterationDecision::Continue;
|
||||
};
|
||||
if (is_runnable_state(state))
|
||||
return for_each_runnable(callback);
|
||||
return for_each_nonrunnable(callback);
|
||||
return for_each_runnable(new_callback);
|
||||
return for_each_nonrunnable(new_callback);
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue