mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 14:27:45 +01:00
Make Framework.DelayTicks() deadlock-safe before the game has started
This commit is contained in:
parent
470267a185
commit
5c250c1725
1 changed files with 2 additions and 2 deletions
|
|
@ -121,9 +121,9 @@ internal sealed class Framework : IInternalDisposableService, IFramework
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Task DelayTicks(long numTicks, CancellationToken cancellationToken = default)
|
public Task DelayTicks(long numTicks, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (this.frameworkDestroy.IsCancellationRequested)
|
if (this.frameworkDestroy.IsCancellationRequested) // Going away
|
||||||
return Task.FromCanceled(this.frameworkDestroy.Token);
|
return Task.FromCanceled(this.frameworkDestroy.Token);
|
||||||
if (numTicks <= 0)
|
if (numTicks <= 0 || this.frameworkThreadTaskScheduler.BoundThread == null) // Nonsense or before first tick
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue