1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

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.
This commit is contained in:
kleines Filmröllchen 2022-07-13 10:33:14 +02:00 committed by Linus Groh
parent 500dc83f32
commit 91913fba59
2 changed files with 3 additions and 0 deletions

View file

@ -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>