diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-07-13 10:33:14 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-22 19:35:41 +0100 |
commit | 91913fba595e9f692cadf141ea0f0c29f789ed7f (patch) | |
tree | feb2450a2aa901cb2651d61ecd43eccfb7db45e8 /Userland/Libraries/LibThreading/Thread.h | |
parent | 500dc83f32e59feb5416301a5caa11e15f87fe0c (diff) | |
download | serenity-91913fba595e9f692cadf141ea0f0c29f789ed7f.zip |
LibThreading: Add is_started state information to Thread
Users can now determine whether a thread has been started or not. A
started thread might also have already terminated.
Implementation note: We *could* detect this with pthread APIs maybe, but
this is much simpler.
Diffstat (limited to 'Userland/Libraries/LibThreading/Thread.h')
-rw-r--r-- | Userland/Libraries/LibThreading/Thread.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index 612403846d..dec19c248a 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -32,6 +32,7 @@ public: String thread_name() const { return m_thread_name; } pthread_t tid() const { return m_tid; } + bool is_started() const { return m_started; } private: explicit Thread(Function<intptr_t()> action, StringView thread_name = {}); @@ -39,6 +40,7 @@ private: pthread_t m_tid { 0 }; String m_thread_name; bool m_detached { false }; + bool m_started { false }; }; template<typename T> |