Header menu logo TDesu.FSharp

TDesu.FSharp.Concurrency Namespace

Concurrency primitives: AtomicInt/Int64, BoundedDict, BoundedQueue, Signal, PeriodicTimer, ChannelWorker, SlidingWindowLimiter.

Type/Module Description

AtomicInt

Thread-safe atomic counter using Interlocked. Zero-allocation reads.

AtomicInt64

Thread-safe atomic int64 counter. The initial counter value.

BoundedDict<'TKey, 'TValue>

Bounded dictionary — auto-evicts the first-inserted key when capacity is reached. Not thread-safe.

BoundedQueue<'T>

Bounded queue — auto-evicts oldest elements when capacity is reached. Not thread-safe.

CancellationToken

CancellationToken helpers — reduces boilerplate for timeout + linked patterns.

ChannelWorker

Generic background worker that processes items sequentially from an internal queue. Fault-tolerant: errors in handlers are reported via callback without crashing the worker. Stops gracefully on cancellation.

PeriodicTimer

Periodic background timer — runs an action at fixed intervals with cancellation.

Signal

One-shot async signal. Wraps TaskCompletionSource{T} for idiomatic F# async coordination.

SlidingWindowLimiter

Sliding-window rate limiter. Tracks request count within a time window. Thread-safe on .NET; single-threaded safe on Fable.

SnapshotThrottle

Snapshot throttle — tracks message count and triggers save at threshold (thread-safe).

Type something to start searching.