IPlatformThreadingInterface.cs 991 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using System.Threading;
  5. using Avalonia.Threading;
  6. namespace Avalonia.Platform
  7. {
  8. /// <summary>
  9. /// Provides platform-specific services relating to threading.
  10. /// </summary>
  11. public interface IPlatformThreadingInterface
  12. {
  13. void RunLoop(CancellationToken cancellationToken);
  14. /// <summary>
  15. /// Starts a timer.
  16. /// </summary>
  17. /// <param name="interval">The interval.</param>
  18. /// <param name="tick">The action to call on each tick.</param>
  19. /// <returns>An <see cref="IDisposable"/> used to stop the timer.</returns>
  20. IDisposable StartTimer(TimeSpan interval, Action tick);
  21. void Signal(DispatcherPriority priority);
  22. bool CurrentThreadIsLoopThread { get; }
  23. event Action<DispatcherPriority?> Signaled;
  24. }
  25. }