diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2020-12-31 00:55:56 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-31 21:59:20 +0100 |
commit | 2b3993b008016eef6752024474eb8a45545caf3f (patch) | |
tree | 6466ec0156df159c0abeb1c5f15d4c5d5f6a3d24 /Libraries/LibThread | |
parent | b7fd5315e512a64dac08f53c0b5128da94bf72f0 (diff) | |
download | serenity-2b3993b008016eef6752024474eb8a45545caf3f.zip |
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.
Diffstat (limited to 'Libraries/LibThread')
-rw-r--r-- | Libraries/LibThread/Thread.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibThread/Thread.h b/Libraries/LibThread/Thread.h index 26ef07d35d..28fba0d78a 100644 --- a/Libraries/LibThread/Thread.h +++ b/Libraries/LibThread/Thread.h @@ -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; |