1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 21:55:07 +00:00

Kernel: Simplify BlockTimeout constructor

This commit is contained in:
Jelle Raaijmakers 2021-04-26 17:21:15 +02:00 committed by Andreas Kling
parent d6dc81874d
commit c3cff7d70a

View file

@ -17,15 +17,15 @@ Thread::BlockTimeout::BlockTimeout(bool is_absolute, const Time* time, const Tim
: m_clock_id(clock_id) : m_clock_id(clock_id)
, m_infinite(!time) , m_infinite(!time)
{ {
if (!m_infinite) { if (m_infinite)
if (*time > Time::zero()) { return;
m_time = *time; if (*time > Time::zero()) {
m_should_block = true; m_time = *time;
} m_should_block = true;
m_start_time = start_time ? *start_time : TimeManagement::the().current_time(clock_id).value();
if (!is_absolute)
m_time = m_time + m_start_time;
} }
m_start_time = start_time ? *start_time : TimeManagement::the().current_time(clock_id).value();
if (!is_absolute)
m_time += m_start_time;
} }
bool Thread::Blocker::set_block_condition(Thread::BlockCondition& block_condition, void* data) bool Thread::Blocker::set_block_condition(Thread::BlockCondition& block_condition, void* data)