IMainLoopDriver.cs 1.1 KB

123456789101112131415161718192021222324
  1. #nullable enable
  2. namespace Terminal.Gui.App;
  3. /// <summary>Interface to create a platform specific <see cref="MainLoop"/> driver.</summary>
  4. internal interface IMainLoopDriver
  5. {
  6. /// <summary>Must report whether there are any events pending, or even block waiting for events.</summary>
  7. /// <returns><see langword="true"/>, if there were pending events, <see langword="false"/> otherwise.</returns>
  8. bool EventsPending ();
  9. /// <summary>The iteration function.</summary>
  10. void Iteration ();
  11. /// <summary>Initializes the <see cref="MainLoop"/>, gets the calling main loop for the initialization.</summary>
  12. /// <remarks>Call <see cref="TearDown"/> to release resources.</remarks>
  13. /// <param name="mainLoop">Main loop.</param>
  14. void Setup (MainLoop mainLoop);
  15. /// <summary>Tears down the <see cref="MainLoop"/> driver. Releases resources created in <see cref="Setup"/>.</summary>
  16. void TearDown ();
  17. /// <summary>Wakes up the <see cref="MainLoop"/> that might be waiting on input, must be thread safe.</summary>
  18. void Wakeup ();
  19. }