Beispiel #1
0
        internal static UniTask <AsyncUnit> CreateTask(LayerTimingPoint timingPoint, CancellationToken cancellationToken)
        {
            var token = _tokenFactory.CreateToken();

            if (ChainInstancePool <LayerTimingAwaitableTaskSource> .TryGetInstanceFast(out var taskSource))
            {
                taskSource._awaitableCore = new(timingPoint, token, cancellationToken);
            }
            else
            {
                taskSource = new LayerTimingAwaitableTaskSource(timingPoint, token, cancellationToken);
            }
            return(new UniTask <AsyncUnit>(taskSource, token));
        }
Beispiel #2
0
 public UniTask <AsyncUnit> Next(CancellationToken cancellationToken = default)
 {
     return(LayerTimingAwaitableTaskSource.CreateTask(this, cancellationToken));
 }
Beispiel #3
0
 private static void Return(LayerTimingAwaitableTaskSource source)
 {
     source._awaitableCore = default;
     ChainInstancePool <LayerTimingAwaitableTaskSource> .ReturnInstanceFast(source);
 }