From 12cf6f86503cee499d093b7accebe6ad11bc1dae Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 1 Dec 2020 16:53:47 -0700 Subject: 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. --- Kernel/ThreadBlockers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Kernel/ThreadBlockers.cpp') diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index b04eccb68c..1bd025a643 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -197,7 +197,7 @@ auto Thread::WriteBlocker::override_timeout(const BlockTimeout& timeout) -> cons if (description.is_socket()) { auto& socket = *description.socket(); if (socket.has_send_timeout()) { - m_timeout = BlockTimeout(false, &socket.send_timeout(), timeout.start_time()); + m_timeout = BlockTimeout(false, &socket.send_timeout(), timeout.start_time(), timeout.clock_id()); if (timeout.is_infinite() || (!m_timeout.is_infinite() && m_timeout.absolute_time() < timeout.absolute_time())) return m_timeout; } @@ -216,7 +216,7 @@ auto Thread::ReadBlocker::override_timeout(const BlockTimeout& timeout) -> const if (description.is_socket()) { auto& socket = *description.socket(); if (socket.has_receive_timeout()) { - m_timeout = BlockTimeout(false, &socket.receive_timeout(), timeout.start_time()); + m_timeout = BlockTimeout(false, &socket.receive_timeout(), timeout.start_time(), timeout.clock_id()); if (timeout.is_infinite() || (!m_timeout.is_infinite() && m_timeout.absolute_time() < timeout.absolute_time())) return m_timeout; } @@ -256,7 +256,7 @@ void Thread::SleepBlocker::calculate_remaining() { if (!m_remaining) return; - auto time_now = TimeManagement::the().monotonic_time(); + auto time_now = TimeManagement::the().current_time(m_deadline.clock_id()).value(); if (time_now < m_deadline.absolute_time()) timespec_sub(m_deadline.absolute_time(), time_now, *m_remaining); else -- cgit v1.2.3