summaryrefslogtreecommitdiff
path: root/Kernel/Thread.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-22 17:20:58 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-22 17:20:58 +0100
commit94ff04b5361cba26b76be7caff1c3edb30b22dd3 (patch)
tree77558f1364b557cb1027b56ce942a941c63f6c89 /Kernel/Thread.cpp
parente07d14f4d93c8eb4fc6896b866d36aa8303d6170 (diff)
downloadserenity-94ff04b5361cba26b76be7caff1c3edb30b22dd3.zip
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.
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r--Kernel/Thread.cpp9
1 files changed, 0 insertions, 9 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 7de2263303..201e9e5446 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -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()) {