mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibThreading: Add new detach() API to Thread
Sometimes you don't care about `joining()` the result of a thread. The underlying pthread implementation already existed for detaching and now we expose it to the higher level API.
This commit is contained in:
parent
5666809889
commit
48731e9f17
Notes:
sideshowbarker
2024-07-18 11:07:05 +09:00
Author: https://github.com/SpencerCDixon
Commit: 48731e9f17
Pull-request: https://github.com/SerenityOS/serenity/pull/8385
Reviewed-by: https://github.com/gunnarbeutner
2 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
||||
* Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -24,6 +25,7 @@ public:
|
|||
virtual ~Thread();
|
||||
|
||||
void start();
|
||||
void detach();
|
||||
|
||||
template<typename T = void>
|
||||
Result<T, ThreadError> join();
|
||||
|
@ -36,6 +38,7 @@ private:
|
|||
Function<intptr_t()> m_action;
|
||||
pthread_t m_tid { 0 };
|
||||
String m_thread_name;
|
||||
bool m_detached { false };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue