mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:47:36 +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:
parent
9a69b9112b
commit
ec27cbbb2a
3 changed files with 15 additions and 11 deletions
|
@ -779,11 +779,6 @@ public:
|
|||
return *m_mm_data;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Thread* idle_thread() const
|
||||
{
|
||||
return m_idle_thread;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void set_idle_thread(Thread& idle_thread)
|
||||
{
|
||||
m_idle_thread = &idle_thread;
|
||||
|
@ -806,6 +801,12 @@ public:
|
|||
write_fs_u32(__builtin_offsetof(Processor, m_current_thread), FlatPtr(¤t_thread));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static Thread* idle_thread()
|
||||
{
|
||||
// See comment in Processor::current_thread
|
||||
return (Thread*)read_fs_u32(__builtin_offsetof(Processor, m_idle_thread));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 get_id() const
|
||||
{
|
||||
// NOTE: This variant should only be used when iterating over all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue