Skip to content

Commit

Permalink
Merge pull request #6362 from AvaloniaUI/fixes/internal-runloop-cancel
Browse files Browse the repository at this point in the history
Respect CancellationToken in InternalPlatformThreadingInterface.RunLoop.
  • Loading branch information
kekekeks authored and Dan Walmsley committed Aug 16, 2021
1 parent 81be6e2 commit 01acb49
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ public InternalPlatformThreadingInterface()

public void RunLoop(CancellationToken cancellationToken)
{
while (true)
var handles = new[] { _signaled, cancellationToken.WaitHandle };

while (!cancellationToken.IsCancellationRequested)
{
Signaled?.Invoke(null);
_signaled.WaitOne();
WaitHandle.WaitAny(handles);
}
}

Expand Down

0 comments on commit 01acb49

Please sign in to comment.