[kernel] Add lock-releasing version of thread::block()

Add a version of thread::block() that takes a lock and releases it after
marking the thread as unready, but before calling the scheduler.

Use this version of block() in the wait_queue.
This commit is contained in:
Justin C. Miller
2023-02-18 17:21:39 -08:00
parent 38ca7004a6
commit 42db1e8899
3 changed files with 28 additions and 5 deletions

View File

@@ -52,6 +52,18 @@ thread::block()
return m_wake_value;
}
uint64_t
thread::block(util::scoped_lock &lock)
{
kassert(current_cpu().thread == this,
"unlocking block() called on non-current thread");
clear_state(state::ready);
lock.release();
scheduler::get().schedule();
return m_wake_value;
}
j6_status_t
thread::join()
{