mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:08:10 +00:00
Kernel: Make CLOCK_MONOTONIC respect the system tick frequency
The time returned by sys$clock_gettime() was not aligned with the delay calculations in sys$clock_nanosleep(). This patch fixes that by taking the system's ticks_per_second value into account in both functions. This patch also removes the need for Thread::sleep_until() and uses Thread::sleep() for both absolute and relative sleeps. This was causing the nesalizer emulator port to sleep for a negative amount of time at the end of each frame, making it run way too fast.
This commit is contained in:
parent
e07d14f4d9
commit
94ff04b536
3 changed files with 18 additions and 27 deletions
|
@ -258,15 +258,6 @@ u64 Thread::sleep(u64 ticks)
|
|||
return wakeup_time;
|
||||
}
|
||||
|
||||
u64 Thread::sleep_until(u64 wakeup_time)
|
||||
{
|
||||
ASSERT(state() == Thread::Running);
|
||||
auto ret = Thread::current()->block<Thread::SleepBlocker>(nullptr, wakeup_time);
|
||||
if (wakeup_time > g_uptime)
|
||||
ASSERT(ret.was_interrupted());
|
||||
return wakeup_time;
|
||||
}
|
||||
|
||||
const char* Thread::state_string() const
|
||||
{
|
||||
switch (state()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue