aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
index 968de930..ccec763e 100644
--- a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
@@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
/// <summary>
/// Array containing all hardware syncpoints.
/// </summary>
- private Syncpoint[] _syncpoints;
+ private readonly Syncpoint[] _syncpoints;
public SynchronizationManager()
{
@@ -118,26 +118,24 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
timeout = TimeSpan.FromSeconds(1);
}
- using (ManualResetEvent waitEvent = new ManualResetEvent(false))
- {
- var info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
-
- if (info == null)
- {
- return false;
- }
+ using ManualResetEvent waitEvent = new(false);
+ var info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
- bool signaled = waitEvent.WaitOne(timeout);
+ if (info == null)
+ {
+ return false;
+ }
- if (!signaled && info != null)
- {
- Logger.Error?.Print(LogClass.Gpu, $"Wait on syncpoint {id} for threshold {threshold} took more than {timeout.TotalMilliseconds}ms, resuming execution...");
+ bool signaled = waitEvent.WaitOne(timeout);
- _syncpoints[id].UnregisterCallback(info);
- }
+ if (!signaled && info != null)
+ {
+ Logger.Error?.Print(LogClass.Gpu, $"Wait on syncpoint {id} for threshold {threshold} took more than {timeout.TotalMilliseconds}ms, resuming execution...");
- return !signaled;
+ _syncpoints[id].UnregisterCallback(info);
}
+
+ return !signaled;
}
}
}