Skip to content

Commit 2c170de

Browse files
Merge pull request #98
2 parents 7bf6233 + f12600a commit 2c170de

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/SharpEmu.Libs/Codec/Videodec2Decoder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,11 @@ private void SchedulerLoop()
312312
var now = DateTime.UtcNow;
313313
if (nextDeadline > now)
314314
{
315-
try
316-
{
317-
Task.Delay(nextDeadline - now, token).GetAwaiter().GetResult();
318-
}
319-
catch (OperationCanceledException)
315+
// <summary>
316+
// Avoids Task and state machine allocations by blocking synchronously on this dedicated thread.
317+
// </summary>
318+
Thread.Sleep(nextDeadline - now);
319+
if (token.IsCancellationRequested)
320320
{
321321
return;
322322
}

0 commit comments

Comments
 (0)