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-06-30 20:02:24 +03:00
parent 6f002f0c07
commit 20663b533b
11 changed files with 62 additions and 26 deletions

View File

@@ -50,6 +50,7 @@ namespace Kernel
[](void* _devfs)
{
auto* devfs = static_cast<DevFileSystem*>(_devfs);
uint64_t next_update_ms = SystemTimer::get().ms_since_boot();
while (true)
{
{
@@ -57,7 +58,8 @@ namespace Kernel
for (auto& device : devfs->m_devices)
device->update();
}
SystemTimer::get().sleep_ms(10);
SystemTimer::get().sleep_until_ms(next_update_ms);
next_update_ms += 10;
}
}, s_instance
));

View File

@@ -157,7 +157,7 @@ namespace Kernel
if (i == 4)
dwarnln("Could not find specified root device, waiting for it to get loaded...");
SystemTimer::get().sleep_ms(sleep_ms);
SystemTimer::get().sleep_for_ms(sleep_ms);
}
derrorln("Could not find root device '{}' after {} ms", root_path, timeout_ms);