mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
Kernel: Move Thread::block<BlockerType>() out of the Thread.h header
This function is large and unwieldy and forces Thread.h to #include a bunch of things. The only reason it was in the header is because we need to instantiate a blocker based on the templated BlockerType. We actually keep block<BlockerType>() in the header, but move the bulk of the function body out of line into Thread::block_impl(). To preserve destructor ordering, we add Blocker::finalize() which is called where we'd previously destroy the Blocker.
This commit is contained in:
parent
79ee846f3d
commit
f469fb47b8
3 changed files with 138 additions and 118 deletions
|
@ -39,7 +39,10 @@ bool Thread::Blocker::add_to_blocker_set(Thread::BlockerSet& blocker_set, void*
|
|||
|
||||
Thread::Blocker::~Blocker()
|
||||
{
|
||||
VERIFY(!m_lock.is_locked());
|
||||
}
|
||||
|
||||
void Thread::Blocker::finalize()
|
||||
{
|
||||
if (m_blocker_set)
|
||||
m_blocker_set->remove_blocker(*this);
|
||||
}
|
||||
|
@ -371,6 +374,11 @@ bool Thread::SelectBlocker::setup_blocker()
|
|||
|
||||
Thread::SelectBlocker::~SelectBlocker()
|
||||
{
|
||||
}
|
||||
|
||||
void Thread::SelectBlocker::finalize()
|
||||
{
|
||||
Thread::FileBlocker::finalize();
|
||||
for (auto& fd_entry : m_fds)
|
||||
fd_entry.description->blocker_set().remove_blocker(*this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue