1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

Kernel: Store whether a thread is the idle thread in Thread directly

This solves a problem where checking whether a thread is an idle
thread may require iterating all processors if it is not the idle
thread of the current processor.
This commit is contained in:
Tom 2021-01-28 20:07:41 -07:00 committed by Andreas Kling
parent 9a69b9112b
commit ec27cbbb2a
3 changed files with 15 additions and 11 deletions

View file

@ -1112,6 +1112,8 @@ public:
return m_handling_page_fault;
}
void set_handling_page_fault(bool b) { m_handling_page_fault = b; }
void set_idle_thread() { m_is_idle_thread = true; }
bool is_idle_thread() const { return m_is_idle_thread; }
private:
Thread(NonnullRefPtr<Process>, NonnullOwnPtr<Region> kernel_stack_region);
@ -1248,6 +1250,7 @@ private:
bool m_should_die { false };
bool m_initialized { false };
bool m_in_block { false };
bool m_is_idle_thread { false };
Atomic<bool> m_have_any_unmasked_pending_signals { false };
void yield_without_holding_big_lock();