1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:45:06 +00:00

Kernel+LibPthread: Implement pthread_join()

It's now possible to block until another thread in the same process has
exited. We can also retrieve its exit value, which is whatever value it
passed to pthread_exit(). :^)
This commit is contained in:
Andreas Kling 2019-11-14 20:58:23 +01:00
parent c6a8b95643
commit 69efa3f630
9 changed files with 117 additions and 5 deletions

View file

@ -238,6 +238,14 @@ void Thread::finalize()
dbgprintf("Finalizing Thread %u in %s(%u)\n", tid(), m_process.name().characters(), pid());
set_state(Thread::State::Dead);
if (m_joiner) {
ASSERT(m_joiner->m_joinee == this);
m_joiner->m_joinee_exit_value = m_exit_value;
m_joiner->m_joinee = nullptr;
// NOTE: We clear the joiner pointer here as well, to be tidy.
m_joiner = nullptr;
}
if (m_dump_backtrace_on_finalization)
dbg() << backtrace_impl();