Show / Hide Table of Contents

Class ConcurrentExtensions

Inheritance
System.Object
ConcurrentExtensions
Namespace: Eco.Core.Utils
Assembly: Eco.Core.dll
Syntax
public static class ConcurrentExtensions : Object

Methods

Consume<T>(IProducerConsumerCollection<T>, Int32)

Consumes maxAmount elements from queue and returns as array. It is thread-safe if queue is thread-safe. MaxAmount = -1 means take all elements. If will take up to number of elements as available when function called. If during function call queue consumed by other threads and in the queue less or equals elements than was when initially requested then result will contain all available elements.

Declaration
public static T[] Consume<T>(this IProducerConsumerCollection<T> queue, int maxAmount = 2147483647)
Parameters
Type Name Description
System.Collections.Concurrent.IProducerConsumerCollection<T> queue
System.Int32 maxAmount
Returns
Type Description
T[]
Type Parameters
Name Description
T
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾