mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
Kernel: Add CLOCK_REALTIME support to the TimerQueue
This allows us to use blocking timeouts with either monotonic or real time for all blockers. Which means that clock_nanosleep() now also supports CLOCK_REALTIME. Also, switch alarm() to use CLOCK_REALTIME as per specification.
This commit is contained in:
parent
4c1e27ec65
commit
12cf6f8650
9 changed files with 182 additions and 97 deletions
|
@ -46,9 +46,9 @@ unsigned Process::sys$alarm(unsigned seconds)
|
|||
}
|
||||
|
||||
if (seconds > 0) {
|
||||
auto deadline = TimeManagement::the().monotonic_time(); // TODO: should be using CLOCK_REALTIME
|
||||
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME).value();
|
||||
timespec_add(deadline, { seconds, 0 }, deadline);
|
||||
m_alarm_timer = TimerQueue::the().add_timer_without_id(deadline, [this]() {
|
||||
m_alarm_timer = TimerQueue::the().add_timer_without_id(CLOCK_REALTIME, deadline, [this]() {
|
||||
(void)send_signal(SIGALRM, nullptr);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue