Kernel: Rework sleeping API

instead of sleep_{ns,ms} we now have sleep_{for,until}_{ns,ms}. This
makes code cleaner that just wants to sleep until some timestamp
This commit is contained in:
2026-07-02 15:22:52 +03:00
parent 6f002f0c07
commit 20663b533b
11 changed files with 62 additions and 26 deletions
+12 -2
View File
@@ -863,11 +863,21 @@ namespace Kernel
return {};
}
BAN::ErrorOr<void> Thread::sleep_or_eintr_ns(uint64_t ns)
BAN::ErrorOr<void> Thread::sleep_or_eintr_for_ns(uint64_t timeout_ns)
{
if (is_interrupted_by_signal(true))
return BAN::Error::from_errno(EINTR);
SystemTimer::get().sleep_ns(ns);
SystemTimer::get().sleep_for_ns(timeout_ns);
if (is_interrupted_by_signal(true))
return BAN::Error::from_errno(EINTR);
return {};
}
BAN::ErrorOr<void> Thread::sleep_or_eintr_until_ns(uint64_t waketime_ns)
{
if (is_interrupted_by_signal(true))
return BAN::Error::from_errno(EINTR);
SystemTimer::get().sleep_until_ns(waketime_ns);
if (is_interrupted_by_signal(true))
return BAN::Error::from_errno(EINTR);
return {};