class · System.Threading
BlockingCollection<T>
public class System.Threading.BlockingCollection<T> : System.Any
A queue that hands items from producers to consumers: Take waits for an item; after CompleteAdding, Take on an empty queue throws and TryTake gives false.
- Kind
- class
- Namespace
- System.Threading
- Assembly
- System.Core
- Access
- public, final
- Source file
Threading.ant
Type parameters
| Name | Constraints |
|---|---|
T | any type |
Inheritance
- Base classes
-
AnyBlockingCollection<T>
Constructors
constructor BlockingCollection()
#
Properties
Methods
method Add(item: T) -> void
#
method Take() -> T
#
The next item (waiting for one).
Whether an item can be taken (waiting for one, unless adding is complete); then Take gives it at once to this consumer only if no other one takes it first.
method CompleteAdding() -> void
#
method Dispose() -> void
#
Frees what it holds (it must not be used after).
Private and internal members (5)
field mutex: System.Threading.Mutex
#
field changed: System.Threading.Condition
#
field items: System.Queue<T>
#
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
BlockingCollection<T> as Larva HIR, decompiled from its Larva HIR.
// A queue that hands items from producers to consumers: Take waits for an item; after CompleteAdding, Take on an
// empty queue throws and TryTake gives false.
public class System.Threading.BlockingCollection<T> : System.Any
{
field mutex: System.Threading.Mutex
field changed: System.Threading.Condition
field items: System.Queue<T>
field completed: bool
field waiters: i32
constructor BlockingCollection()
method Add(item: T) -> void
// The next item (waiting for one).
method Take() -> T
// Whether an item can be taken (waiting for one, unless adding is complete); then Take gives it at once to
// this consumer only if no other one takes it first.
method WaitForItem() -> bool
method CompleteAdding() -> void
// Frees what it holds (it must not be used after).
method Dispose() -> void
property IsAddingCompleted: bool
property IsCompleted: bool
property Count: i32
}