2 parents 7bf6233 + f12600a commit 2c170deCopy full SHA for 2c170de
1 file changed
src/SharpEmu.Libs/Codec/Videodec2Decoder.cs
@@ -312,11 +312,11 @@ private void SchedulerLoop()
312
var now = DateTime.UtcNow;
313
if (nextDeadline > now)
314
{
315
- try
316
- {
317
- Task.Delay(nextDeadline - now, token).GetAwaiter().GetResult();
318
- }
319
- catch (OperationCanceledException)
+ // <summary>
+ // Avoids Task and state machine allocations by blocking synchronously on this dedicated thread.
+ // </summary>
+ Thread.Sleep(nextDeadline - now);
+ if (token.IsCancellationRequested)
320
321
return;
322
}
0 commit comments