Browse Source

Fixes #3520. NetDriver is consuming too much CPU resources in ReadConsoleKeyInfo and in CheckWindowSizeChange.

BDisp 1 year ago
parent
commit
d91f2fac45
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Terminal.Gui/ConsoleDrivers/NetDriver.cs

+ 2 - 2
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -208,7 +208,7 @@ internal class NetEvents : IDisposable
 
         while (!cancellationToken.IsCancellationRequested)
         {
-            Task.Delay (100);
+            Task.Delay (100, cancellationToken).Wait (cancellationToken);
 
             if (Console.KeyAvailable)
             {
@@ -338,7 +338,7 @@ internal class NetEvents : IDisposable
             while (!cancellationToken.IsCancellationRequested)
             {
                 // Wait for a while then check if screen has changed sizes
-                Task.Delay (500, cancellationToken);
+                Task.Delay (500, cancellationToken).Wait (cancellationToken);
 
                 int buffHeight, buffWidth;