mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Add thread_join syscall
Thread joining is an important primitive that I seem to have totally forgotten to implement previously.
This commit is contained in:
@@ -52,6 +52,20 @@ thread::block()
|
||||
return m_wake_value;
|
||||
}
|
||||
|
||||
j6_status_t
|
||||
thread::join()
|
||||
{
|
||||
if (has_state(state::exited))
|
||||
return j6_status_ok;
|
||||
|
||||
thread &caller = current();
|
||||
if (&caller == this)
|
||||
return j6_err_invalid_arg;
|
||||
|
||||
m_join_queue.add_thread(&caller);
|
||||
return caller.block();
|
||||
}
|
||||
|
||||
void
|
||||
thread::wake(uint64_t value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user