mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
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.
This commit is contained in:
parent
76c135ddcf
commit
d8c8820ee9
Notes:
sideshowbarker
2024-07-19 04:37:36 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/d8c8820ee92 Pull-request: https://github.com/SerenityOS/serenity/pull/2192 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/elcuco
|
@ -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;
|
||||
|
|
|
@ -297,7 +297,7 @@ public:
|
|||
VirtualAddress thread_specific_data() const { return m_thread_specific_data; }
|
||||
size_t thread_specific_region_size() const { return m_thread_specific_region_size; }
|
||||
|
||||
u64 sleep(u32 ticks);
|
||||
u64 sleep(u64 ticks);
|
||||
u64 sleep_until(u64 wakeup_time);
|
||||
|
||||
class BlockResult {
|
||||
|
|
Loading…
Reference in a new issue