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()
|
private void ActivateIdleThread()
|
||||||
{
|
{
|
||||||
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
||||||
{ }
|
{
|
||||||
|
Thread.SpinWait(1);
|
||||||
|
}
|
||||||
|
|
||||||
Thread.MemoryBarrier();
|
Thread.MemoryBarrier();
|
||||||
|
|
||||||
|
@ -251,7 +253,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||||
private void NotifyIdleThread()
|
private void NotifyIdleThread()
|
||||||
{
|
{
|
||||||
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
while (Interlocked.CompareExchange(ref _coreIdleLock, 1, 0) != 0)
|
||||||
{ }
|
{
|
||||||
|
Thread.SpinWait(1);
|
||||||
|
}
|
||||||
|
|
||||||
Thread.MemoryBarrier();
|
Thread.MemoryBarrier();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue