1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:47:45 +00:00

LibCore: Allow event loops on other threads to wake up

Because the wake pipe is thread-local, it was previously not possible
to wake an event loop across a thread. Therefore, this commit
rearchitects event loop waking by making the wake function a member of
the event loop itself and having it keep a pointer to its thread's wake
pipe. The global wake() function calls wake on the current thread's
event loop.

This also fixes a bug in BackgroundAction: it should wake the event loop
it was created on, instead of the current thread's event loop.
This commit is contained in:
kleines Filmröllchen 2022-02-11 16:57:10 +01:00 committed by Andreas Kling
parent 716a3429fa
commit 704bb361bb
4 changed files with 27 additions and 9 deletions

View file

@ -63,7 +63,7 @@ private:
m_on_complete(m_result.release_value());
remove_from_parent();
});
Core::EventLoop::wake();
origin_event_loop->wake();
} else {
this->remove_from_parent();
}