forked from Bananymous/banan-os
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:
@@ -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
|
||||
));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user