1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

Kernel: Remove confusing nested scope in Thread::block()

There was a nested scope here that didn't actually scope anything
meaningfully, so just get rid of it.
This commit is contained in:
Andreas Kling 2021-08-24 13:34:07 +02:00
parent a22634bb59
commit 97f5383525

View file

@ -862,7 +862,7 @@ public:
// synchronize on the spin locks already. // synchronize on the spin locks already.
Atomic<bool, AK::MemoryOrder::memory_order_relaxed> timeout_unblocked(false); Atomic<bool, AK::MemoryOrder::memory_order_relaxed> timeout_unblocked(false);
bool timer_was_added = false; bool timer_was_added = false;
{
switch (state()) { switch (state()) {
case Thread::Stopped: case Thread::Stopped:
// It's possible that we were requested to be stopped! // It's possible that we were requested to be stopped!
@ -876,8 +876,7 @@ public:
m_blocker = &blocker; m_blocker = &blocker;
auto& block_timeout = blocker.override_timeout(timeout); if (auto& block_timeout = blocker.override_timeout(timeout); !block_timeout.is_infinite()) {
if (!block_timeout.is_infinite()) {
// Process::kill_all_threads may be called at any time, which will mark all // Process::kill_all_threads may be called at any time, which will mark all
// threads to die. In that case // threads to die. In that case
timer_was_added = TimerQueue::the().add_timer_without_id(*m_block_timer, block_timeout.clock_id(), block_timeout.absolute_time(), [&]() { timer_was_added = TimerQueue::the().add_timer_without_id(*m_block_timer, block_timeout.clock_id(), block_timeout.absolute_time(), [&]() {
@ -901,7 +900,6 @@ public:
blocker.begin_blocking({}); blocker.begin_blocking({});
set_state(Thread::Blocked); set_state(Thread::Blocked);
}
scheduler_lock.unlock(); scheduler_lock.unlock();
block_lock.unlock(); block_lock.unlock();