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

Kernel: Make block() and yield() automatically call Scheduler::yield().

This exposed some places we were accidentally doing a double yield().
This commit is contained in:
Andreas Kling 2019-03-24 01:52:10 +01:00
parent 5713c3a0cb
commit 239c0bd6a6
6 changed files with 10 additions and 28 deletions

View file

@ -118,20 +118,14 @@ void Thread::block(Thread::State new_state)
system.nblocked++;
m_was_interrupted_while_blocked = false;
set_state(new_state);
}
void block(Thread::State state)
{
current->block(state);
Scheduler::yield();
}
void sleep(dword ticks)
void Thread::sleep(dword ticks)
{
ASSERT(current->state() == Thread::Running);
ASSERT(state() == Thread::Running);
current->set_wakeup_time(system.uptime + ticks);
current->block(Thread::BlockedSleep);
Scheduler::yield();
}
const char* to_string(Thread::State state)