mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:35:08 +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:
parent
c6a8b95643
commit
69efa3f630
9 changed files with 117 additions and 5 deletions
|
@ -68,6 +68,19 @@ void Scheduler::beep()
|
|||
s_beep_timeout = g_uptime + 100;
|
||||
}
|
||||
|
||||
Thread::JoinBlocker::JoinBlocker(Thread& joinee)
|
||||
: m_joinee(joinee)
|
||||
{
|
||||
ASSERT(m_joinee.m_joiner == nullptr);
|
||||
m_joinee.m_joiner = current;
|
||||
current->m_joinee = &joinee;
|
||||
}
|
||||
|
||||
bool Thread::JoinBlocker::should_unblock(Thread& joiner, time_t, long)
|
||||
{
|
||||
return !joiner.m_joinee;
|
||||
}
|
||||
|
||||
Thread::FileDescriptionBlocker::FileDescriptionBlocker(const FileDescription& description)
|
||||
: m_blocked_description(description)
|
||||
{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue