summaryrefslogtreecommitdiff
path: root/Kernel/Thread.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-05-11 14:50:21 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-25 20:21:25 +0200
commitd8c8820ee922c2ee89d11963c96f312c5fe6be87 (patch)
treef9acc207c3d89c7ee087934d9c2c18247ad242b3 /Kernel/Thread.cpp
parent76c135ddcf7853df9d559cb0ebc774c73bed44f5 (diff)
downloadserenity-d8c8820ee922c2ee89d11963c96f312c5fe6be87.zip
Kernel: Allow Thread::sleep for more than 388 days
Because Thread::sleep is an internal interface, it's easy to check that there are only few callers: Process::sys$sleep, usleep, and nanosleep are happy with this increased size, because now they support the entire range of their arguments (assuming small-ish values for ticks_per_second()). SyncTask doesn't care. Note that the old behavior wasn't "cap out at 388 days", which would have been reasonable. Instead, the code resulted in unsigned overflow, meaning that a very long sleep would "on average" end after about 194 days, sometimes much quicker.
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r--Kernel/Thread.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 01842b06b4..f9044109f4 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -220,7 +220,7 @@ void Thread::relock_process(bool did_unlock)
process().big_lock().lock();
}
-u64 Thread::sleep(u32 ticks)
+u64 Thread::sleep(u64 ticks)
{
ASSERT(state() == Thread::Running);
u64 wakeup_time = g_uptime + ticks;