Skip to content

PooledDelaySource class

Defined in

Namespace: ReactiveUI.Primitives.Async.Advanced Assembly: ReactiveUI.Primitives.Async.Core.dll Full name: ReactiveUI.Primitives.Async.Advanced.PooledDelaySource Modifiers: public sealed

Summary

View source

Poolable IValueTaskSource used by DelayAsync for the non-System TimeProvider code path. Replaces the per-call TaskCompletionSource + Task + CancellationTokenRegistration allocation chain with a rented-then-returned instance. The wrapped ManualResetValueTaskSourceCore is the standard poolable async-primitive shape from System.Threading.Tasks.Sources.

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Class hierarchy
classDiagram
class PooledDelaySource
class IValueTaskSource {
    <>
}
IValueTaskSource <|.. PooledDelaySource

Implements: IValueTaskSource

Remarks

Completion is claimed by whichever of the timer callback or the cancellation registration fires first, using an CompareExchange on a state flag. The loser is a no-op. After the caller awaits the returned ValueTask, the instance is reset and pushed back to the pool inside GetResult.

Methods

NameSummary
static RentRents a source from the per-thread cache, allocating a new one only on cache miss.
BeginAsyncBegins the delay. The returned ValueTask completes when the timer fires or the cancellation token is signalled — whichever...
GetStatus
OnCompleted
GetResult
Inherited members