Use spinwait so we don't completely blast the CPU with cmpxchg
This commit is contained in:
parent
83f2eb9495
commit
90a21959e7
1 changed files with 6 additions and 2 deletions
|
@ -236,7 +236,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
private void ActivateIdleThread()
|
||||
{
|
||||
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
||||
{ }
|
||||
{
|
||||
Thread.SpinWait(1);
|
||||
}
|
||||
|
||||
Thread.MemoryBarrier();
|
||||
|
||||
|
@ -251,7 +253,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
private void NotifyIdleThread()
|
||||
{
|
||||
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
||||
{ }
|
||||
{
|
||||
Thread.SpinWait(1);
|
||||
}
|
||||
|
||||
Thread.MemoryBarrier();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue