1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Kernel: Move Thread::m_joinee_exit_value into the JoinBlocker

There's no need for this to be a permanent Thread member. Just use a
reference in the JoinBlocker instead.
This commit is contained in:
Andreas Kling 2019-11-14 21:04:34 +01:00
parent 69efa3f630
commit cb5021419e
4 changed files with 10 additions and 7 deletions

View file

@ -2906,15 +2906,17 @@ int Process::sys$join_thread(int tid, void** exit_value)
// FIXME: EINVAL: 'thread' is not a joinable thread
void* joinee_exit_value = nullptr;
// FIXME: pthread_join() should not be interruptable. Enforce this somehow?
auto result = current->block<Thread::JoinBlocker>(*thread);
auto result = current->block<Thread::JoinBlocker>(*thread, joinee_exit_value);
(void)result;
// NOTE: 'thread' is very possibly deleted at this point. Clear it just to be safe.
thread = nullptr;
if (exit_value)
*exit_value = current->m_joinee_exit_value;
*exit_value = joinee_exit_value;
return 0;
}