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

Kernel: Clean up around Scheduler::yield() a bit.

Also add assertion in Lock that the scheduler isn't currently active.
I've been seeing occasional fuckups that I suspect might be someone called
by the scheduler trying to take a busy lock.
This commit is contained in:
Andreas Kling 2019-02-06 15:05:47 +01:00
parent 27263b6172
commit 8cc6e304ca
4 changed files with 23 additions and 28 deletions

View file

@ -1109,7 +1109,7 @@ ssize_t Process::sys$read(int fd, void* outbuf, size_t nread)
if (!descriptor->can_read(*this)) {
m_blocked_fd = fd;
block(BlockedRead);
sched_yield();
Scheduler::yield();
if (m_was_interrupted_while_blocked)
return -EINTR;
}
@ -1572,7 +1572,7 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
m_waitee_pid = waitee;
block(BlockedWait);
sched_yield();
Scheduler::yield();
if (m_was_interrupted_while_blocked)
return -EINTR;
Process* waitee_process;
@ -1612,7 +1612,7 @@ void Process::block(Process::State new_state)
void block(Process::State state)
{
current->block(state);
sched_yield();
Scheduler::yield();
}
void sleep(dword ticks)
@ -1620,7 +1620,7 @@ void sleep(dword ticks)
ASSERT(current->state() == Process::Running);
current->set_wakeup_time(system.uptime + ticks);
current->block(Process::BlockedSleep);
sched_yield();
Scheduler::yield();
}
static bool is_inside_kernel_code(LinearAddress laddr)