diff --git a/Dalamud/Game/Framework.cs b/Dalamud/Game/Framework.cs
index e03ea882e..9e520daab 100644
--- a/Dalamud/Game/Framework.cs
+++ b/Dalamud/Game/Framework.cs
@@ -141,7 +141,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
}
///
- public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default)
+ public Task Run(Action action, CancellationToken cancellationToken = default)
{
if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@@ -149,7 +149,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
}
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default)
+ public Task Run(Func action, CancellationToken cancellationToken = default)
{
if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@@ -157,7 +157,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
}
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default)
+ public Task Run(Func action, CancellationToken cancellationToken = default)
{
if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@@ -165,7 +165,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
}
///
- public Task RunOnFrameworkThreadAwaitable(Func> action, CancellationToken cancellationToken = default)
+ public Task Run(Func> action, CancellationToken cancellationToken = default)
{
if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
@@ -558,20 +558,20 @@ internal class FrameworkPluginScoped : IInternalDisposableService, IFramework
this.frameworkService.DelayTicks(numTicks, cancellationToken);
///
- public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default) =>
- this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken);
+ public Task Run(Action action, CancellationToken cancellationToken = default) =>
+ this.frameworkService.Run(action, cancellationToken);
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default) =>
- this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken);
+ public Task Run(Func action, CancellationToken cancellationToken = default) =>
+ this.frameworkService.Run(action, cancellationToken);
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default) =>
- this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken);
+ public Task Run(Func action, CancellationToken cancellationToken = default) =>
+ this.frameworkService.Run(action, cancellationToken);
///
- public Task RunOnFrameworkThreadAwaitable(Func> action, CancellationToken cancellationToken = default) =>
- this.frameworkService.RunOnFrameworkThreadAwaitable(action, cancellationToken);
+ public Task Run(Func> action, CancellationToken cancellationToken = default) =>
+ this.frameworkService.Run(action, cancellationToken);
///
public Task RunOnFrameworkThread(Func func)
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
index 0c86466e3..f4086fe5a 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs
@@ -182,7 +182,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Every 60f (Await)"))
{
- _ = framework.RunOnFrameworkThreadAwaitable(
+ _ = framework.Run(
async () =>
{
for (var i = 0L; ; i++)
@@ -200,7 +200,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Every 1s (Await)"))
{
- _ = framework.RunOnFrameworkThreadAwaitable(
+ _ = framework.Run(
async () =>
{
for (var i = 0L; ; i++)
@@ -241,7 +241,7 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.Button("Freeze Completely"))
{
- _ = framework.RunOnFrameworkThreadAwaitable(() => Helper().Wait());
+ _ = framework.Run(() => Helper().Wait());
static async Task Helper() => await Task.Delay(1000);
}
diff --git a/Dalamud/Plugin/Services/IFramework.cs b/Dalamud/Plugin/Services/IFramework.cs
index 4b04b633e..f1a4b6906 100644
--- a/Dalamud/Plugin/Services/IFramework.cs
+++ b/Dalamud/Plugin/Services/IFramework.cs
@@ -9,18 +9,18 @@ namespace Dalamud.Plugin.Services;
/// This class represents the Framework of the native game client and grants access to various subsystems.
///
///
-/// Choosing between RunOnFrameworkThread and RunOnFrameworkThreadAwaitable
+/// Choosing between RunOnFrameworkThread and Run
///
/// - If you do need to do use await and have your task keep executing on the main thread after waiting is
-/// done, use RunOnFrameworkThreadAwaitable.
+/// done, use Run.
/// - If you need to call or , use
-/// RunOnFrameworkThread.
+/// RunOnFrameworkThread. It also skips the task scheduler if invoked already from the framework thread.
///
/// 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 , which would make the task run on the framework
-/// thread if invoked via RunOnFrameworkThreadAwaitable. This includes Task.Factory.StartNew and
+/// thread if invoked via Run. This includes Task.Factory.StartNew and
/// Task.ContinueWith. Use Task.Run if you need to start a new task from the callback specified to
-/// RunOnFrameworkThreadAwaitable, as it will force your task to be run in the default thread pool.
+/// Run, as it will force your task to be run in the default thread pool.
/// See to see the difference in behaviors, and how would a misuse of these
/// functions result in a deadlock.
///
@@ -85,10 +85,10 @@ public interface IFramework
/// Starting new tasks and waiting on them synchronously from this callback will completely lock up
/// the game. Use await if you need to wait on something from an async callback.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
- public Task RunOnFrameworkThreadAwaitable(Action action, CancellationToken cancellationToken = default);
+ public Task Run(Action action, CancellationToken cancellationToken = default);
///
/// 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
/// Starting new tasks and waiting on them synchronously from this callback will completely lock up
/// the game. Use await if you need to wait on something from an async callback.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default);
+ public Task Run(Func action, CancellationToken cancellationToken = default);
///
/// 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
/// Starting new tasks and waiting on them synchronously from this callback will completely lock up
/// the game. Use await if you need to wait on something from an async callback.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
- public Task RunOnFrameworkThreadAwaitable(Func action, CancellationToken cancellationToken = default);
+ public Task Run(Func action, CancellationToken cancellationToken = default);
///
/// 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
/// Starting new tasks and waiting on them synchronously from this callback will completely lock up
/// the game. Use await if you need to wait on something from an async callback.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
- public Task RunOnFrameworkThreadAwaitable(Func> action, CancellationToken cancellationToken = default);
+ public Task Run(Func> action, CancellationToken cancellationToken = default);
///
/// 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
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnFrameworkThread(Func func);
@@ -163,11 +163,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnFrameworkThread(Action action);
@@ -181,11 +181,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
[Obsolete($"Use {nameof(RunOnTick)} instead.")]
@@ -199,11 +199,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
[Obsolete($"Use {nameof(RunOnTick)} instead.")]
@@ -221,11 +221,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnTick(Func func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@@ -241,11 +241,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnTick(Action action, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@@ -262,11 +262,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnTick(Func> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
@@ -282,11 +282,11 @@ public interface IFramework
///
/// await, Task.Factory.StartNew or alike will continue off the framework thread.
/// Awaiting on the returned from RunOnFrameworkThread,
- /// RunOnFrameworkThreadAwaitable, or RunOnTick right away inside the callback specified to this
+ /// Run, or RunOnTick right away inside the callback specified to this
/// function has a chance of locking up the game. Do not do await framework.RunOnFrameworkThread(...);
/// directly or indirectly from the delegate passed to this function.
/// See the remarks on if you need to choose which one to use, between
- /// RunOnFrameworkThreadAwaitable and RunOnFrameworkThread. Note that RunOnTick is a fancy
+ /// Run and RunOnFrameworkThread. Note that RunOnTick is a fancy
/// version of RunOnFrameworkThread.
///
public Task RunOnTick(Func func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);