Beispiel #1
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);
        }
Beispiel #2
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()));
        }
Beispiel #3
0
        public bool TryTake(out T item, TimeSpan timeout)
        {
            BlockingCollection <T> .ValidateTimeout(timeout);

            return(this.TryTakeWithNoTimeValidation(out item, (int)timeout.TotalMilliseconds, CancellationToken.None, null));
        }
Beispiel #4
0
        public bool TryAdd(T item, TimeSpan timeout)
        {
            BlockingCollection <T> .ValidateTimeout(timeout);

            return(this.TryAddWithNoTimeValidation(item, (int)timeout.TotalMilliseconds, new CancellationToken()));
        }