mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +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:
parent
73b2cb9ed8
commit
cc68654a44
9 changed files with 127 additions and 7 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue