Header menu logo TDesu.FSharp

ChannelWorker.BoundedHandle<'T> Type

Handle for a running bounded channel worker. Backed by Channel{T} instead of Handle{T}'s unbounded queue, so a producer that outruns the handler waits for room instead of growing memory without limit.

Instance members

Instance member Description

this.Complete

Full Usage: this.Complete

Stops accepting new items but lets the worker finish everything already queued — Completion completes once the queue drains. The graceful counterpart to cancelling the token passed to startBounded, which abandons the queue as soon as the handler in progress returns and can leave items unprocessed.

Idempotent — safe to call more than once, or after the worker has already stopped.

this.Completion

Full Usage: this.Completion

Returns: Task

The task representing the worker loop. Completes once the cancellation token passed to fires — possibly with items still unprocessed — or once was called and the queue has fully drained.

Returns: Task

this.PendingCount

Full Usage: this.PendingCount

Returns: int

Current number of queued (unprocessed) items.

Returns: int

this.PostAsync

Full Usage: this.PostAsync

Parameters:
    item : 'T - The item to enqueue for processing.
    ct : CancellationToken - Cancellation token for this call.

Returns: Task

Waits for room, then queues item.

item : 'T

The item to enqueue for processing.

ct : CancellationToken

Cancellation token for this call.

Returns: Task
OperationCanceledException When ct fires, or the worker's own cancellation token fires first.
ChannelClosedException When Complete was already called.

this.TryPost

Full Usage: this.TryPost

Parameters:
    item : 'T - The item to enqueue for processing.

Returns: bool

Queues item if there is room; false when the queue is full, when Complete has been called, or once the worker's own cancellation token has fired. Never blocks.

item : 'T

The item to enqueue for processing.

Returns: bool

Type something to start searching.