Пример #1
0
        public static AllValueTaskSource Request(IEnumerable <ValueTask> tasks)
        {
            AllValueTaskSource source = null;

            if (_pool.Count == 0)
            {
                source = new AllValueTaskSource();
            }
            else
            {
                source = _pool.Pop();
            }
            var token = AllocateToken();

            source.Initialize(tasks, token);
            return(source);
        }
Пример #2
0
        public static ValueTask WhenAll(IEnumerable <ValueTask> tasks)
        {
            var source = AllValueTaskSource.Request(tasks);

            return(new ValueTask(source, source.Token));
        }