mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibThreading: Remove Thread's inheritance from Core::EventReceiver
Inheritance from `EventReceiver` on the `Thread` class was only used in the `BackgroundAction` class, where the children vector was keeping the action alive until the work was completed. However, this can be accomplished by instead capturing a `NonnullRefPtr` of `this`. The work function can then avoid having to remove the `BackgroundAction` from its parent `Thread` when the work completes.
This commit is contained in:
parent
925afcd4b0
commit
71df0ee994
Notes:
sideshowbarker
2024-07-17 06:35:16 +09:00
Author: https://github.com/Zaggy1024
Commit: 71df0ee994
Pull-request: https://github.com/SerenityOS/serenity/pull/20350
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 28 additions and 29 deletions
|
@ -12,8 +12,7 @@
|
|||
namespace Threading {
|
||||
|
||||
Thread::Thread(Function<intptr_t()> action, StringView thread_name)
|
||||
: Core::EventReceiver(nullptr)
|
||||
, m_action(move(action))
|
||||
: m_action(move(action))
|
||||
, m_thread_name(thread_name.is_null() ? ""sv : thread_name)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue