summaryrefslogtreecommitdiff
path: root/Kernel/ThreadBlockers.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-01 16:53:47 -0700
committerAndreas Kling <kling@serenityos.org>2020-12-02 13:02:04 +0100
commit12cf6f86503cee499d093b7accebe6ad11bc1dae (patch)
tree4d7da8b3e662ff64a83bc3fa97f927e60ed5966c /Kernel/ThreadBlockers.cpp
parent4c1e27ec656d26e85d0a7a1991c26a67aed115a2 (diff)
downloadserenity-12cf6f86503cee499d093b7accebe6ad11bc1dae.zip
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.
Diffstat (limited to 'Kernel/ThreadBlockers.cpp')
-rw-r--r--Kernel/ThreadBlockers.cpp6
1 files changed, 3 insertions, 3 deletions
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