mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-22 01:55:10 +00:00
Use volatile read/writes for GAL threading (#4327)
This commit is contained in:
parent
6adf15e479
commit
423dbc8888
1 changed files with 2 additions and 2 deletions
|
@ -135,7 +135,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
|||
// The other thread can only increase the command count.
|
||||
// We can assume that if it is above 0, it will stay there or get higher.
|
||||
|
||||
while (_commandCount > 0 && Volatile.Read(ref _interruptAction) == null)
|
||||
while (Volatile.Read(ref _commandCount) > 0 && Volatile.Read(ref _interruptAction) == null)
|
||||
{
|
||||
int commandPtr = _consumerPtr;
|
||||
|
||||
|
@ -169,7 +169,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
|||
|
||||
internal ref T New<T>() where T : struct
|
||||
{
|
||||
while (_producerPtr == (_consumerPtr + QueueCount - 1) % QueueCount)
|
||||
while (_producerPtr == (Volatile.Read(ref _consumerPtr) + QueueCount - 1) % QueueCount)
|
||||
{
|
||||
// If incrementing the producer pointer would overflow, we need to wait.
|
||||
// _consumerPtr can only move forward, so there's no race to worry about here.
|
||||
|
|
Loading…
Reference in a new issue