mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +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
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