Browse Source

Merge pull request #6362 from AvaloniaUI/fixes/internal-runloop-cancel

Respect CancellationToken in InternalPlatformThreadingInterface.RunLoop.
release/0.10.7
Nikita Tsukanov 5 years ago
committed by Dan Walmsley
parent
commit
01acb49cfd
  1. 6
      src/Avalonia.Controls/Platform/InternalPlatformThreadingInterface.cs

6
src/Avalonia.Controls/Platform/InternalPlatformThreadingInterface.cs

@ -21,10 +21,12 @@ namespace Avalonia.Controls.Platform
public void RunLoop(CancellationToken cancellationToken)
{
while (true)
var handles = new[] { _signaled, cancellationToken.WaitHandle };
while (!cancellationToken.IsCancellationRequested)
{
Signaled?.Invoke(null);
_signaled.WaitOne();
WaitHandle.WaitAny(handles);
}
}

Loading…
Cancel
Save