diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-11-24 20:55:37 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-24 21:36:28 +0100 |
commit | d51173e4c445e769d8dc1ce908f5b988e840ed70 (patch) | |
tree | 16bed85213b87a823dfce7263568e3941fb14b18 /Libraries/LibThread | |
parent | 3ac0c9b9e73e44c5af5dd111fc7a0679f0caf706 (diff) | |
download | serenity-d51173e4c445e769d8dc1ce908f5b988e840ed70.zip |
LibThread: Add API to join a thread
Diffstat (limited to 'Libraries/LibThread')
-rw-r--r-- | Libraries/LibThread/Thread.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibThread/Thread.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibThread/Thread.cpp b/Libraries/LibThread/Thread.cpp index 58db14bbed..658a5d1163 100644 --- a/Libraries/LibThread/Thread.cpp +++ b/Libraries/LibThread/Thread.cpp @@ -64,6 +64,11 @@ void LibThread::Thread::start() dbg() << "Started a thread, tid = " << m_tid; } +void LibThread::Thread::join() +{ + pthread_join(m_tid, nullptr); +} + void LibThread::Thread::quit(void* code) { ASSERT(m_tid == pthread_self()); diff --git a/Libraries/LibThread/Thread.h b/Libraries/LibThread/Thread.h index 01e8388246..26ef07d35d 100644 --- a/Libraries/LibThread/Thread.h +++ b/Libraries/LibThread/Thread.h @@ -41,6 +41,7 @@ public: virtual ~Thread(); void start(); + void join(); void quit(void* code = 0); pthread_t tid() const { return m_tid; } |