Skip to content

Commit

Permalink
Kernel: Do not wait before first attempt at locking SpinLock (Serenit…
Browse files Browse the repository at this point in the history
  • Loading branch information
tryfinally committed Aug 19, 2020
1 parent c711d34 commit 983f4f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Kernel/SpinLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class SpinLock {
{
u32 prev_flags;
Processor::current().enter_critical(prev_flags);
BaseType expected;
do {
BaseType expected = 0;
while (!m_lock.compare_exchange_strong(expected, 1, AK::memory_order_acq_rel)) {
Processor::wait_check();
expected = 0;
} while (!m_lock.compare_exchange_strong(expected, 1, AK::memory_order_acq_rel));
}
return prev_flags;
}

Expand Down

0 comments on commit 983f4f9

Please sign in to comment.