Merge pull request #9923 from liamwhite/kht

kernel: add timer pointer to KThreadQueue
This commit is contained in:
liamwhite 2023-03-10 16:19:41 -05:00 committed by GitHub
commit 92c89312fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 15 deletions

View file

@ -1290,9 +1290,10 @@ Result KThread::Sleep(s64 timeout) {
ASSERT(timeout > 0);
ThreadQueueImplForKThreadSleep wait_queue_(kernel);
KHardwareTimer* timer{};
{
// Setup the scheduling lock and sleep.
KScopedSchedulerLockAndSleep slp(kernel, this, timeout);
KScopedSchedulerLockAndSleep slp(kernel, std::addressof(timer), this, timeout);
// Check if the thread should terminate.
if (this->IsTerminationRequested()) {
@ -1301,6 +1302,7 @@ Result KThread::Sleep(s64 timeout) {
}
// Wait for the sleep to end.
wait_queue_.SetHardwareTimer(timer);
this->BeginWait(std::addressof(wait_queue_));
SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Sleep);
}