Merge pull request #493 from Cysharp/hadashiA/monitor

Reduce the times of AwakeMonitor checking
master
hadashiA 2023-09-08 17:18:50 +09:00 committed by GitHub
commit 06346b8a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -32,13 +32,11 @@ namespace Cysharp.Threading.Tasks.Triggers
if (cancellationTokenSource == null)
{
cancellationTokenSource = new CancellationTokenSource();
if (!awakeCalled)
{
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));
}
}
if (!awakeCalled)
{
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));
}
return cancellationTokenSource.Token;
}
}
@ -83,7 +81,7 @@ namespace Cysharp.Threading.Tasks.Triggers
public bool MoveNext()
{
if (trigger.called) return false;
if (trigger.called || trigger.awakeCalled) return false;
if (trigger == null)
{
trigger.OnDestroy();