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); }
public static ValueTask WhenAll(IEnumerable <ValueTask> tasks) { var source = AllValueTaskSource.Request(tasks); return(new ValueTask(source, source.Token)); }