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.

Tipo
class
Espacio de nombres
System.Threading
Ensamblado
System.Core
Acceso
public, final
Archivo fuente
Threading.ant

Parámetros de tipo

NombreRestricciones
Tcualquier tipo

Herencia

Clases base
Any BlockingCollection<T>

Constructores

constructor BlockingCollection()
#

Propiedades

property IsAddingCompleted: bool
#

read-only

property IsCompleted: bool
#

read-only

property Count: i32
#

read-only

Métodos

method Add(item: T) -> void
#
method Take() -> T
#

The next item (waiting for one).

method WaitForItem() -> bool
#

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).

Miembros privados e internos (5)

field mutex: System.Threading.Mutex
#

private

field changed: System.Threading.Condition
#

private

field items: System.Queue<T>
#

private

field completed: bool
#

private

field waiters: i32
#

private

Miembros heredados (5)

Código fuente

BlockingCollection<T> en Larva HIR, descompilado a partir de su Larva HIR.

System.Threading.BlockingCollection.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
}
Esc