Exemple #1
0
        public static int TryTakeFromAny(BlockingCollection <T>[] collections, out T item, int millisecondsTimeout, CancellationToken cancellationToken)
        {
            BlockingCollection <T> .ValidateMillisecondsTimeout(millisecondsTimeout);

            T   local = default(T);
            int num   = BlockingCollection <T> .TryAddTakeAny(collections, ref local, millisecondsTimeout, OperationMode <T> .Take, cancellationToken);

            item = local;
            return(num);
        }
Exemple #2
0
        public static int TryTakeFromAny(BlockingCollection <T>[] collections, out T item, TimeSpan timeout)
        {
            BlockingCollection <T> .ValidateTimeout(timeout);

            T   local = default(T);
            int num   = BlockingCollection <T> .TryAddTakeAny(collections, ref local, (int)timeout.TotalMilliseconds, OperationMode <T> .Take, new CancellationToken());

            item = local;
            return(num);
        }
Exemple #3
0
        public static int TryAddToAny(BlockingCollection <T>[] collections, T item, int millisecondsTimeout, CancellationToken cancellationToken)
        {
            BlockingCollection <T> .ValidateMillisecondsTimeout(millisecondsTimeout);

            return(BlockingCollection <T> .TryAddTakeAny(collections, ref item, millisecondsTimeout, OperationMode <T> .Add, cancellationToken));
        }
Exemple #4
0
        public static int TryAddToAny(BlockingCollection <T>[] collections, T item, TimeSpan timeout)
        {
            BlockingCollection <T> .ValidateTimeout(timeout);

            return(BlockingCollection <T> .TryAddTakeAny(collections, ref item, (int)timeout.TotalMilliseconds, OperationMode <T> .Add, new CancellationToken()));
        }