1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibThread: Hide Thread's constructor, as it is a Core::Object

Just constructing one of these guys on the stack willy nilly will leak
the first reference to them. There might be other C_OBJECTs that have
public constructors, seems like a good place for some static analysis
checks :).

Force users to call the construct() method for it.
This commit is contained in:
Andrew Kaster 2020-12-31 00:55:56 -07:00 committed by Andreas Kling
parent b7fd5315e5
commit 2b3993b008
5 changed files with 8 additions and 8 deletions

View file

@ -37,7 +37,6 @@ class Thread final : public Core::Object {
C_OBJECT(Thread);
public:
explicit Thread(Function<int()> action, StringView thread_name = nullptr);
virtual ~Thread();
void start();
@ -46,6 +45,7 @@ public:
pthread_t tid() const { return m_tid; }
private:
explicit Thread(Function<int()> action, StringView thread_name = nullptr);
Function<int()> m_action;
pthread_t m_tid { 0 };
String m_thread_name;