Example #1
0
        public static ValueTask <WhenAnyResult> WhenAny(IEnumerable <ValueTask> tasks)
        {
            var token = AllocateToken();
            AnyValueTaskSource source = null;

            if (_pool.Count > 0)
            {
                source = _pool.Pop();
            }
            else
            {
                source = new AnyValueTaskSource();
            }
            source.Initialize(tasks, token);
            return(new ValueTask <WhenAnyResult>(source, token));
        }
 public static ValueTask <WhenAnyResult> WhenAny(params ValueTask[] tasks)
 {
     return(AnyValueTaskSource.WhenAny(tasks));
 }
 public static ValueTask <WhenAnyResult> WhenAny(IEnumerable <ValueTask> tasks)
 {
     return(AnyValueTaskSource.WhenAny(tasks));
 }