mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 06:07:59 +00:00
Kernel+LibC: Implement clock_gettime() and clock_nanosleep()
Only the CLOCK_MONOTONIC clock is supported at the moment, and it only has millisecond precision. :^)
This commit is contained in:
@@ -154,6 +154,15 @@ u64 Thread::sleep(u32 ticks)
|
||||
return wakeup_time;
|
||||
}
|
||||
|
||||
u64 Thread::sleep_until(u64 wakeup_time)
|
||||
{
|
||||
ASSERT(state() == Thread::Running);
|
||||
auto ret = current->block<Thread::SleepBlocker>(wakeup_time);
|
||||
if (wakeup_time > g_uptime)
|
||||
ASSERT(ret == Thread::BlockResult::InterruptedBySignal);
|
||||
return wakeup_time;
|
||||
}
|
||||
|
||||
const char* Thread::state_string() const
|
||||
{
|
||||
switch (state()) {
|
||||
|
||||
Reference in New Issue
Block a user