mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 14:55:28 +03:00
Fix missed attempt increment in spinlock
Should hog CPU slightly less and correctly yield now
This commit is contained in:
parent
35a46acbb1
commit
4e5141f879
@ -18,6 +18,7 @@ namespace skyline {
|
|||||||
if (!locked.test_and_set(std::memory_order_acquire))
|
if (!locked.test_and_set(std::memory_order_acquire))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
attempt++;
|
||||||
if (attempt % LockAttemptsPerSleep == 0)
|
if (attempt % LockAttemptsPerSleep == 0)
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||||
else if (attempt % LockAttemptsPerYield == 0)
|
else if (attempt % LockAttemptsPerYield == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user