Kernel: Do not wait before first attempt at locking SpinLock (#3212)

This commit is contained in:
Muhammad Zahalqa 2020-08-19 12:10:53 +03:00 committed by GitHub
parent c711d34276
commit 983f4f935c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-19 03:25:58 +09:00

View file

@ -45,11 +45,11 @@ public:
{
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;
}