Rename to Framework.Run (#1728)

This commit is contained in:
srkizer 2024-03-20 00:04:21 +09:00 committed by GitHub
parent 5d473919a1
commit be63276a85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 44 deletions

View file

@ -141,7 +141,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
} }
/// <inheritdoc/> /// <inheritdoc/>
public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default) public Task Run(Action action, CancellationToken cancellationToken = default)
{ {
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@ -149,7 +149,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
} }
/// <inheritdoc/> /// <inheritdoc/>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<T> action, CancellationToken cancellationToken = default) public Task<T> Run<T>(Func<T> action, CancellationToken cancellationToken = default)
{ {
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@ -157,7 +157,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
} }
/// <inheritdoc/> /// <inheritdoc/>
public Task RunOnFrameworkThreadAwaitable(Func<Task> action, CancellationToken cancellationToken = default) public Task Run(Func<Task> action, CancellationToken cancellationToken = default)
{ {
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@ -165,7 +165,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
} }
/// <inheritdoc/> /// <inheritdoc/>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<Task<T>> action, CancellationToken cancellationToken = default) public Task<T> Run<T>(Func<Task<T>> action, CancellationToken cancellationToken = default)
{ {
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@ -558,20 +558,20 @@ internal class FrameworkPluginScoped : IInternalDisposableService, IFramework
this.frameworkService.DelayTicks(numTicks, cancellationToken); this.frameworkService.DelayTicks(numTicks, cancellationToken);
/// <inheritdoc/> /// <inheritdoc/>
public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default) => public Task Run(Action action, CancellationToken cancellationToken = default) =>
this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken); this.frameworkService.Run(action, cancellationToken);
/// <inheritdoc/> /// <inheritdoc/>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<T> action, CancellationToken cancellationToken = default) => public Task<T> Run<T>(Func<T> action, CancellationToken cancellationToken = default) =>
this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken); this.frameworkService.Run(action, cancellationToken);
/// <inheritdoc/> /// <inheritdoc/>
public Task RunOnFrameworkThreadAwaitable(Func<Task> action, CancellationToken cancellationToken = default) => public Task Run(Func<Task> action, CancellationToken cancellationToken = default) =>
this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken); this.frameworkService.Run(action, cancellationToken);
/// <inheritdoc/> /// <inheritdoc/>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<Task<T>> action, CancellationToken cancellationToken = default) => public Task<T> Run<T>(Func<Task<T>> action, CancellationToken cancellationToken = default) =>
this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken); this.frameworkService.Run(action, cancellationToken);
/// <inheritdoc/> /// <inheritdoc/>
public Task<T> RunOnFrameworkThread<T>(Func<T> func) public Task<T> RunOnFrameworkThread<T>(Func<T> func)

View file

@ -182,7 +182,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Every 60f (Await)")) if (ImGui.Button("Every 60f (Await)"))
{ {
_ = framework.RunOnFrameworkThreadAwaitable( _ = framework.Run(
async () => async () =>
{ {
for (var i = 0L; ; i++) for (var i = 0L; ; i++)
@ -200,7 +200,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Every 1s (Await)")) if (ImGui.Button("Every 1s (Await)"))
{ {
_ = framework.RunOnFrameworkThreadAwaitable( _ = framework.Run(
async () => async () =>
{ {
for (var i = 0L; ; i++) for (var i = 0L; ; i++)
@ -241,7 +241,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Freeze Completely")) if (ImGui.Button("Freeze Completely"))
{ {
_ = framework.RunOnFrameworkThreadAwaitable(() => Helper().Wait()); _ = framework.Run(() => Helper().Wait());
static async Task Helper() => await Task.Delay(1000); static async Task Helper() => await Task.Delay(1000);
} }

View file

@ -9,18 +9,18 @@ namespace Dalamud.Plugin.Services;
/// This class represents the Framework of the native game client and grants access to various subsystems. /// This class represents the Framework of the native game client and grants access to various subsystems.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// <para><b>Choosing between <c>RunOnFrameworkThread</c> and <c>RunOnFrameworkThreadAwaitable</c></b></para> /// <para><b>Choosing between <c>RunOnFrameworkThread</c> and <c>Run</c></b></para>
/// <ul> /// <ul>
/// <li>If you do need to do use <c>await</c> and have your task keep executing on the main thread after waiting is /// <li>If you do need to do use <c>await</c> and have your task keep executing on the main thread after waiting is
/// done, use <c>RunOnFrameworkThreadAwaitable</c>.</li> /// done, use <c>Run</c>.</li>
/// <li>If you need to call <see cref="Task.Wait()"/> or <see cref="Task{TResult}.Result"/>, use /// <li>If you need to call <see cref="Task.Wait()"/> or <see cref="Task{TResult}.Result"/>, use
/// <c>RunOnFrameworkThread</c>.</li> /// <c>RunOnFrameworkThread</c>. It also skips the task scheduler if invoked already from the framework thread.</li>
/// </ul> /// </ul>
/// <para>The game is likely to completely lock up if you call above synchronous function and getter, because starting /// <para>The game is likely to completely lock up if you call above synchronous function and getter, because starting
/// a new task by default runs on <see cref="TaskScheduler.Current"/>, which would make the task run on the framework /// a new task by default runs on <see cref="TaskScheduler.Current"/>, which would make the task run on the framework
/// thread if invoked via <c>RunOnFrameworkThreadAwaitable</c>. This includes <c>Task.Factory.StartNew</c> and /// thread if invoked via <c>Run</c>. This includes <c>Task.Factory.StartNew</c> and
/// <c>Task.ContinueWith</c>. Use <c>Task.Run</c> if you need to start a new task from the callback specified to /// <c>Task.ContinueWith</c>. Use <c>Task.Run</c> if you need to start a new task from the callback specified to
/// <c>RunOnFrameworkThreadAwaitable</c>, as it will force your task to be run in the default thread pool.</para> /// <c>Run</c>, as it will force your task to be run in the default thread pool.</para>
/// <para>See <see cref="TaskSchedulerWidget"/> to see the difference in behaviors, and how would a misuse of these /// <para>See <see cref="TaskSchedulerWidget"/> to see the difference in behaviors, and how would a misuse of these
/// functions result in a deadlock.</para> /// functions result in a deadlock.</para>
/// </remarks> /// </remarks>
@ -85,10 +85,10 @@ public interface IFramework
/// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up /// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up
/// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para> /// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default); public Task Run(Action action, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call. /// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
@ -101,10 +101,10 @@ public interface IFramework
/// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up /// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up
/// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para> /// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<T> action, CancellationToken cancellationToken = default); public Task<T> Run<T>(Func<T> action, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call. /// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
@ -116,10 +116,10 @@ public interface IFramework
/// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up /// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up
/// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para> /// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task RunOnFrameworkThreadAwaitable(Func<Task> action, CancellationToken cancellationToken = default); public Task Run(Func<Task> action, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call. /// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
@ -132,10 +132,10 @@ public interface IFramework
/// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up /// <para>Starting new tasks and waiting on them <b>synchronously</b> from this callback will completely lock up
/// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para> /// the game. Use <c>await</c> if you need to wait on something from an <c>async</c> callback.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task<T> RunOnFrameworkThreadAwaitable<T>(Func<Task<T>> action, CancellationToken cancellationToken = default); public Task<T> Run<T>(Func<Task<T>> action, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call. /// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
@ -146,11 +146,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task<T> RunOnFrameworkThread<T>(Func<T> func); public Task<T> RunOnFrameworkThread<T>(Func<T> func);
@ -163,11 +163,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task RunOnFrameworkThread(Action action); public Task RunOnFrameworkThread(Action action);
@ -181,11 +181,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
[Obsolete($"Use {nameof(RunOnTick)} instead.")] [Obsolete($"Use {nameof(RunOnTick)} instead.")]
@ -199,11 +199,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
[Obsolete($"Use {nameof(RunOnTick)} instead.")] [Obsolete($"Use {nameof(RunOnTick)} instead.")]
@ -221,11 +221,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task<T> RunOnTick<T>(Func<T> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default); public Task<T> RunOnTick<T>(Func<T> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@ -241,11 +241,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task RunOnTick(Action action, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default); public Task RunOnTick(Action action, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@ -262,11 +262,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task<T> RunOnTick<T>(Func<Task<T>> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default); public Task<T> RunOnTick<T>(Func<Task<T>> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@ -282,11 +282,11 @@ public interface IFramework
/// <remarks> /// <remarks>
/// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para> /// <para><c>await</c>, <c>Task.Factory.StartNew</c> or alike will continue off the framework thread.</para>
/// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>, /// <para>Awaiting on the returned <see cref="Task"/> from <c>RunOnFrameworkThread</c>,
/// <c>RunOnFrameworkThreadAwaitable</c>, or <c>RunOnTick</c> right away inside the callback specified to this /// <c>Run</c>, or <c>RunOnTick</c> right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c> /// function has a chance of locking up the game. Do not do <c>await framework.RunOnFrameworkThread(...);</c>
/// directly or indirectly from the delegate passed to this function.</para> /// directly or indirectly from the delegate passed to this function.</para>
/// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between /// <para>See the remarks on <see cref="IFramework"/> if you need to choose which one to use, between
/// <c>RunOnFrameworkThreadAwaitable</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy /// <c>Run</c> and <c>RunOnFrameworkThread</c>. Note that <c>RunOnTick</c> is a fancy
/// version of <c>RunOnFrameworkThread</c>.</para> /// version of <c>RunOnFrameworkThread</c>.</para>
/// </remarks> /// </remarks>
public Task RunOnTick(Func<Task> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default); public Task RunOnTick(Func<Task> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);