diff --git a/src/ReactiveUI.Primitives.Async/AsyncContext.cs b/src/ReactiveUI.Primitives.Async/AsyncContext.cs
index 73dba9f..1a8ac9c 100644
--- a/src/ReactiveUI.Primitives.Async/AsyncContext.cs
+++ b/src/ReactiveUI.Primitives.Async/AsyncContext.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -58,7 +58,7 @@ private AsyncContext()
/// Gets a value indicating whether the current context uses the default task scheduler and no synchronization
/// context.
///
- internal bool IsDefaultContext => SynchronizationContext is null &&
+ internal bool UsesDefaultSequencer => SynchronizationContext is null &&
Sequencer is null &&
(TaskScheduler is null || TaskScheduler == TaskScheduler.Default);
@@ -250,7 +250,7 @@ private sealed class ContinuationWorkItem(Action continuation) : IWorkItem
"Performance",
"CA1812:Avoid uninstantiated internal classes",
Justification = "Kept as an internal adapter for generator and test smoke scenarios that need TaskScheduler-shaped sequencer execution.")]
- internal sealed class SchedulerTaskScheduler(ISequencer scheduler) : TaskScheduler
+ internal sealed class SequencerTaskScheduler(ISequencer scheduler) : TaskScheduler
{
///
/// Gets the sequencer used by this task-scheduler adapter.
diff --git a/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsync.cs b/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsync.cs
index bf62276..b310555 100644
--- a/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsync.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -19,7 +19,7 @@ public static class DisposableAsync
///
/// Use this property when an is required but no disposal logic is
/// necessary. This can be useful as a default or placeholder implementation.
- public static IAsyncDisposable Empty { get; } = new EmptyAsyncDisposable();
+ public static IAsyncDisposable Empty { get; } = new NoopAsyncDisposable();
///
/// Creates a new asynchronous disposable object that invokes the specified delegate when disposed asynchronously.
@@ -31,7 +31,7 @@ public static IAsyncDisposable Create(Func disposeAsync)
{
ArgumentExceptionHelper.ThrowIfNull(disposeAsync);
- return new AnonymousAsyncDisposable(disposeAsync);
+ return new DelegateAsyncDisposable(disposeAsync);
}
///
@@ -48,13 +48,13 @@ public static IAsyncDisposable Create(TState state, Func(state, disposeAsync);
+ return new DelegateAsyncDisposable(state, disposeAsync);
}
///
/// An asynchronous disposable that invokes a delegate when disposed.
///
- internal sealed class AnonymousAsyncDisposable(Func disposeAsync) : IAsyncDisposable
+ internal sealed class DelegateAsyncDisposable(Func disposeAsync) : IAsyncDisposable
{
///
/// A flag indicating whether has already been called (0 = not disposed, 1 = disposed).
@@ -71,7 +71,7 @@ internal sealed class AnonymousAsyncDisposable(Func disposeAsync) : I
/// name="TState"/>.
///
/// The type of the state passed to the dispose delegate.
- internal sealed class AnonymousAsyncDisposable(TState state, Func disposeAsync) : IAsyncDisposable
+ internal sealed class DelegateAsyncDisposable(TState state, Func disposeAsync) : IAsyncDisposable
{
///
/// A flag indicating whether has already been called (0 = not disposed, 1 = disposed).
@@ -85,7 +85,7 @@ internal sealed class AnonymousAsyncDisposable(TState state, Func
/// An asynchronous disposable that performs no action when disposed.
///
- internal sealed class EmptyAsyncDisposable : IAsyncDisposable
+ internal sealed class NoopAsyncDisposable : IAsyncDisposable
{
///
public ValueTask DisposeAsync() => default;
diff --git a/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsyncSlot.cs b/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsyncSlot.cs
index c73d543..b7f4cd1 100644
--- a/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsyncSlot.cs
+++ b/src/ReactiveUI.Primitives.Async/Disposables/DisposableAsyncSlot.cs
@@ -32,7 +32,7 @@ public static ValueTask SwapAsync(ref IAsyncDisposable? slot, IAsyncDisposable?
var current = Volatile.Read(ref slot);
while (true)
{
- if (ReferenceEquals(current, DisposedSentinel.Instance))
+ if (ReferenceEquals(current, DisposedSlotMarker.Instance))
{
return value?.DisposeAsync() ?? default;
}
@@ -64,7 +64,7 @@ public static ValueTask AssignAsync(ref IAsyncDisposable? slot, IAsyncDisposable
return default;
}
- if (ReferenceEquals(current, DisposedSentinel.Instance))
+ if (ReferenceEquals(current, DisposedSlotMarker.Instance))
{
return value?.DisposeAsync() ?? default;
}
@@ -80,8 +80,8 @@ public static ValueTask AssignAsync(ref IAsyncDisposable? slot, IAsyncDisposable
[DebuggerStepThrough]
public static ValueTask DisposeAsync(ref IAsyncDisposable? slot)
{
- var current = Interlocked.Exchange(ref slot, DisposedSentinel.Instance);
- if (current is null || ReferenceEquals(current, DisposedSentinel.Instance))
+ var current = Interlocked.Exchange(ref slot, DisposedSlotMarker.Instance);
+ if (current is null || ReferenceEquals(current, DisposedSlotMarker.Instance))
{
return default;
}
@@ -93,15 +93,15 @@ public static ValueTask DisposeAsync(ref IAsyncDisposable? slot)
/// The slot field to inspect.
/// if the slot currently holds the disposed sentinel.
public static bool IsDisposed(IAsyncDisposable? slot) =>
- ReferenceEquals(slot, DisposedSentinel.Instance);
+ ReferenceEquals(slot, DisposedSlotMarker.Instance);
/// Shared sentinel marking a disposed slot. Distinct from the per-class sentinels in
/// and so the
/// slot helpers can be used independently of (and alongside) those wrapper classes.
- internal sealed class DisposedSentinel : IAsyncDisposable
+ internal sealed class DisposedSlotMarker : IAsyncDisposable
{
/// Singleton sentinel instance.
- public static readonly DisposedSentinel Instance = new();
+ public static readonly DisposedSlotMarker Instance = new();
///
ValueTask IAsyncDisposable.DisposeAsync() => default;
diff --git a/src/ReactiveUI.Primitives.Async/Disposables/SingleAssignmentDisposableAsync.cs b/src/ReactiveUI.Primitives.Async/Disposables/SingleAssignmentDisposableAsync.cs
index caed3f6..d28cbd0 100644
--- a/src/ReactiveUI.Primitives.Async/Disposables/SingleAssignmentDisposableAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Disposables/SingleAssignmentDisposableAsync.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -24,7 +24,7 @@ public sealed class SingleAssignmentDisposableAsync : IAsyncDisposable
///
/// Gets a value indicating whether the object has been disposed.
///
- public bool IsDisposed => ReferenceEquals(Volatile.Read(ref _current), DisposedSentinel.Instance);
+ public bool IsDisposed => ReferenceEquals(Volatile.Read(ref _current), DisposedSlotMarker.Instance);
///
/// Gets the current asynchronous disposable resource, or an empty disposable if the resource has already been
@@ -35,7 +35,7 @@ public sealed class SingleAssignmentDisposableAsync : IAsyncDisposable
public IAsyncDisposable? GetDisposable()
{
var field = Volatile.Read(ref _current);
- if (ReferenceEquals(field, DisposedSentinel.Instance))
+ if (ReferenceEquals(field, DisposedSlotMarker.Instance))
{
return DisposableAsync.Empty;
}
@@ -50,7 +50,7 @@ public sealed class SingleAssignmentDisposableAsync : IAsyncDisposable
/// The new instance to set as the current resource, or to
/// clear the current resource.
/// A that represents the asynchronous operation.
- public ValueTask SetDisposableAsync(IAsyncDisposable? value) => SetDisposableAsync(ref _current, value);
+ public ValueTask SetDisposableAsync(IAsyncDisposable? value) => AssignDisposableAsync(ref _current, value);
///
/// Asynchronously releases the unmanaged resources used by the object.
@@ -69,7 +69,7 @@ public sealed class SingleAssignmentDisposableAsync : IAsyncDisposable
/// The instance to assign to the field, or null to leave the field unset.
/// A that represents the asynchronous dispose operation if the field was already disposed;
/// otherwise, a default .
- internal static ValueTask SetDisposableAsync(ref IAsyncDisposable? field, IAsyncDisposable? value)
+ internal static ValueTask AssignDisposableAsync(ref IAsyncDisposable? field, IAsyncDisposable? value)
{
var current = Interlocked.CompareExchange(ref field, value, null);
if (current == null)
@@ -78,7 +78,7 @@ internal static ValueTask SetDisposableAsync(ref IAsyncDisposable? field, IAsync
return default;
}
- if (ReferenceEquals(current, DisposedSentinel.Instance))
+ if (ReferenceEquals(current, DisposedSlotMarker.Instance))
{
if (value is not null)
{
@@ -104,8 +104,8 @@ internal static ValueTask SetDisposableAsync(ref IAsyncDisposable? field, IAsync
[DebuggerStepThrough]
internal static ValueTask DisposeAsync(ref IAsyncDisposable? field)
{
- var current = Interlocked.Exchange(ref field, DisposedSentinel.Instance);
- if (ReferenceEquals(current, DisposedSentinel.Instance) || current is null)
+ var current = Interlocked.Exchange(ref field, DisposedSlotMarker.Instance);
+ if (ReferenceEquals(current, DisposedSlotMarker.Instance) || current is null)
{
return default;
}
@@ -123,12 +123,12 @@ internal static InvalidOperationException CreateAlreadyAssignedException() =>
///
/// A sentinel object used to indicate that the has been disposed.
///
- internal sealed class DisposedSentinel : IAsyncDisposable
+ internal sealed class DisposedSlotMarker : IAsyncDisposable
{
///
- /// Gets the singleton instance of .
+ /// Gets the singleton instance of .
///
- public static readonly DisposedSentinel Instance = new();
+ public static readonly DisposedSlotMarker Instance = new();
///
ValueTask IAsyncDisposable.DisposeAsync() => default;
diff --git a/src/ReactiveUI.Primitives.Async/Disposables/SingleReplaceableDisposableAsync.cs b/src/ReactiveUI.Primitives.Async/Disposables/SingleReplaceableDisposableAsync.cs
index 07e9243..1136294 100644
--- a/src/ReactiveUI.Primitives.Async/Disposables/SingleReplaceableDisposableAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Disposables/SingleReplaceableDisposableAsync.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -37,7 +37,7 @@ public ValueTask SetDisposableAsync(IAsyncDisposable? value)
var field = Volatile.Read(ref _current);
while (true)
{
- if (ReferenceEquals(field, DisposedSentinel.Instance))
+ if (ReferenceEquals(field, DisposedSlotMarker.Instance))
{
if (value is not null)
{
@@ -71,8 +71,8 @@ public ValueTask SetDisposableAsync(IAsyncDisposable? value)
/// have been released.
public ValueTask DisposeAsync()
{
- var field = Interlocked.Exchange(ref _current, DisposedSentinel.Instance);
- if (!ReferenceEquals(field, DisposedSentinel.Instance) && field is not null)
+ var field = Interlocked.Exchange(ref _current, DisposedSlotMarker.Instance);
+ if (!ReferenceEquals(field, DisposedSlotMarker.Instance) && field is not null)
{
// Dispose the current resource asynchronously.
var disposeTask = field.DisposeAsync();
@@ -90,12 +90,12 @@ public ValueTask DisposeAsync()
///
/// A sentinel object used to indicate that the has been disposed.
///
- internal sealed class DisposedSentinel : IAsyncDisposable
+ internal sealed class DisposedSlotMarker : IAsyncDisposable
{
///
- /// Gets the singleton instance of .
+ /// Gets the singleton instance of .
///
- public static readonly DisposedSentinel Instance = new();
+ public static readonly DisposedSlotMarker Instance = new();
///
public ValueTask DisposeAsync() => default;
diff --git a/src/ReactiveUI.Primitives.Async/Internals/AsyncGate.cs b/src/ReactiveUI.Primitives.Async/Internals/AsyncSerialGate.cs
similarity index 74%
rename from src/ReactiveUI.Primitives.Async/Internals/AsyncGate.cs
rename to src/ReactiveUI.Primitives.Async/Internals/AsyncSerialGate.cs
index 0d72beb..b0e1370 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/AsyncGate.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/AsyncSerialGate.cs
@@ -16,10 +16,10 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
///
/// Same-thread reentry is granted via an owner-thread-id check, with a non-shared recursion
-/// counter; nested releases just decrement it. Cross-thread reentry inside a single lock
-/// acquisition would deadlock — no in-tree caller exercises that pattern.
+/// counter; nested exits just decrement it. Cross-thread reentry inside a single gate entry
+/// would deadlock — no in-tree caller exercises that pattern.
///
-internal sealed class AsyncGate : IDisposable
+internal sealed class AsyncSerialGate : IDisposable
{
///
/// Signal-only semaphore used to wake one waiter when the gate is released. Initial count is
@@ -35,13 +35,13 @@ internal sealed class AsyncGate : IDisposable
private int _ownerThreadId;
///
- /// Number of nested calls beyond the initial acquisition. Read / written
+ /// Number of nested calls beyond the initial acquisition. Read / written
/// only by the owning thread, so unguarded mutation is safe.
///
private int _recursionDepth;
///
- /// Count of awaiters parked on the slow path. Read by to decide whether
+ /// Count of awaiters parked on the slow path. Read by to decide whether
/// to signal the semaphore; incremented / decremented around each .
///
private int _waiters;
@@ -53,16 +53,16 @@ internal sealed class AsyncGate : IDisposable
/// Gets the number of awaiters currently parked on the slow path. Exposed for
/// deterministic contention tests so they can spin-wait until a contender has entered
- /// before tripping the release.
+ /// before tripping the release.
internal int WaitersCount => Volatile.Read(ref _waiters);
///
- /// Asynchronously acquires the gate, returning a that releases it on disposal.
+ /// Asynchronously acquires the gate, returning a that releases it on disposal.
///
/// The cancellation token.
- /// A that completes when the gate has been acquired.
+ /// A that completes when the gate has been acquired.
[DebuggerStepThrough]
- public ValueTask LockAsync(CancellationToken cancellationToken = default)
+ public ValueTask EnterAsync(CancellationToken cancellationToken = default)
{
var currentThreadId = Environment.CurrentManagedThreadId;
@@ -70,16 +70,16 @@ public ValueTask LockAsync(CancellationToken cancellationToken = defau
if (Volatile.Read(ref _ownerThreadId) == currentThreadId)
{
_recursionDepth++;
- return new(new Releaser(this));
+ return new(new Lease(this));
}
// Fast uncontended acquire: pure CAS, no semaphore touch.
if (Interlocked.CompareExchange(ref _ownerThreadId, currentThreadId, 0) == 0)
{
- return new(new Releaser(this));
+ return new(new Lease(this));
}
- return WaitForReleaseAsync(cancellationToken);
+ return WaitForEntryAsync(cancellationToken);
}
///
@@ -95,10 +95,10 @@ public void Dispose()
}
///
- /// Releases the gate. Decrements the recursion depth on a nested release, or clears the owner
+ /// Exits the gate. Decrements the recursion depth on a nested exit, or clears the owner
/// and signals one waiter (if any) on the outermost release.
///
- internal void Release()
+ internal void Exit()
{
if (_recursionDepth > 0)
{
@@ -107,7 +107,7 @@ internal void Release()
}
Volatile.Write(ref _ownerThreadId, 0);
- SignalIfWaiting();
+ WakeNextWaiter();
}
///
@@ -115,7 +115,7 @@ internal void Release()
/// read / race lands harmlessly in
/// the semaphore count and is consumed by the next waiter that arrives.
///
- private void SignalIfWaiting()
+ private void WakeNextWaiter()
{
if (Volatile.Read(ref _waiters) == 0)
{
@@ -129,8 +129,8 @@ private void SignalIfWaiting()
/// Slow path: park as a waiter and retry the acquire CAS after each semaphore signal.
///
/// Cancellation token observed while waiting.
- /// A for the acquired gate.
- private async ValueTask WaitForReleaseAsync(CancellationToken cancellationToken)
+ /// A for the acquired gate.
+ private async ValueTask WaitForEntryAsync(CancellationToken cancellationToken)
{
Interlocked.Increment(ref _waiters);
try
@@ -154,22 +154,22 @@ private async ValueTask WaitForReleaseAsync(CancellationToken cancella
}
///
- /// Releases a previously acquired when disposed.
+ /// Releases a previously acquired when disposed.
///
- public readonly record struct Releaser : IDisposable
+ public readonly record struct Lease : IDisposable
{
///
- /// The parent whose lock is released when this releaser is disposed.
+ /// The parent whose lock is released when this lease is disposed.
///
- private readonly AsyncGate _parent;
+ private readonly AsyncSerialGate _parent;
///
- /// Initializes a new instance of the struct.
+ /// Initializes a new instance of the struct.
///
- /// The that owns this releaser.
- public Releaser(AsyncGate parent) => _parent = parent;
+ /// The that owns this lease.
+ public Lease(AsyncSerialGate parent) => _parent = parent;
///
- public void Dispose() => _parent.Release();
+ public void Dispose() => _parent.Exit();
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Internals/AnonymousSignalAsync.cs b/src/ReactiveUI.Primitives.Async/Internals/CallbackSignalAsync.cs
similarity index 85%
rename from src/ReactiveUI.Primitives.Async/Internals/AnonymousSignalAsync.cs
rename to src/ReactiveUI.Primitives.Async/Internals/CallbackSignalAsync.cs
index 861e56e..ab0eb94 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/AnonymousSignalAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/CallbackSignalAsync.cs
@@ -5,11 +5,11 @@
namespace ReactiveUI.Primitives.Async.Internals;
///
-/// An observable that delegates subscription logic to a user-supplied asynchronous function.
+/// An observable that invokes a callback to create each subscription.
///
/// The type of the elements in the observable sequence.
/// The asynchronous function invoked when an observer subscribes.
-internal sealed class AnonymousSignalAsync(
+internal sealed class CallbackSignalAsync(
Func, CancellationToken, ValueTask> subscribeAsync) : SignalAsync
{
///
diff --git a/src/ReactiveUI.Primitives.Async/Internals/AnonymousObserverAsync.cs b/src/ReactiveUI.Primitives.Async/Internals/CallbackWitnessAsync.cs
similarity index 80%
rename from src/ReactiveUI.Primitives.Async/Internals/AnonymousObserverAsync.cs
rename to src/ReactiveUI.Primitives.Async/Internals/CallbackWitnessAsync.cs
index b6c8f89..b7bb485 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/AnonymousObserverAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/CallbackWitnessAsync.cs
@@ -1,17 +1,17 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
namespace ReactiveUI.Primitives.Async.Internals;
///
-/// An observer that delegates notification handling to user-supplied asynchronous functions.
+/// An witness that routes notifications through user-supplied asynchronous callbacks.
///
-/// The type of the elements received by the observer.
+/// The type of the elements received by the witness.
/// The asynchronous function invoked for each element.
/// An optional asynchronous function invoked when a resumable error occurs.
/// An optional asynchronous function invoked when the sequence completes.
-internal sealed class AnonymousObserverAsync(
+internal sealed class CallbackWitnessAsync(
Func onNextAsync,
Func? onErrorResumeAsync = null,
Func? onCompletedAsync = null) : ObserverAsync
@@ -25,7 +25,7 @@ protected override ValueTask OnErrorResumeAsyncCore(Exception error, Cancellatio
{
if (onErrorResumeAsync is null)
{
- UnhandledExceptionHandler.OnUnhandledException(error);
+ UnhandledExceptionHandler.ReportUnhandledException(error);
return default;
}
@@ -40,7 +40,7 @@ protected override ValueTask OnCompletedAsyncCore(Result result)
var exception = result.Exception;
if (exception is not null)
{
- UnhandledExceptionHandler.OnUnhandledException(exception);
+ UnhandledExceptionHandler.ReportUnhandledException(exception);
}
return default;
diff --git a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestSubscriptionBase.cs b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestCoordinatorBase.cs
similarity index 82%
rename from src/ReactiveUI.Primitives.Async/Internals/CombineLatestSubscriptionBase.cs
rename to src/ReactiveUI.Primitives.Async/Internals/CombineLatestCoordinatorBase.cs
index ac80816..e00d014 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestSubscriptionBase.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestCoordinatorBase.cs
@@ -6,20 +6,20 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
/// Shared scaffolding for the arity-specific CombineLatestN subscription types. Each
-/// per-arity CombineLatestSubscription derives from this class so the otherwise-identical
+/// per-arity CombineLatestCoordinator derives from this class so the otherwise-identical
/// wiring (gate / dispose CTS / external link),
/// the values-lock, the source-subscribe loop, the error-resume forwarder, and
/// live here once instead of repeated 15× across CombineLatest2..16.
///
/// The downstream element type.
-internal abstract class CombineLatestSubscriptionBase : IAsyncDisposable
+internal abstract class CombineLatestCoordinatorBase : IAsyncDisposable
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The number of upstream sources (e.g. 2 for arity-2).
- protected CombineLatestSubscriptionBase(IObserverAsync observer, int sourceCount)
+ protected CombineLatestCoordinatorBase(IObserverAsync observer, int sourceCount)
{
Lifecycle = new(observer, sourceCount);
}
@@ -28,7 +28,7 @@ protected CombineLatestSubscriptionBase(IObserverAsync observer, int so
internal CombineLatestLifecycle Lifecycle { get; }
/// Gets the lock protecting per-arity latest-values caches. Internal so the shared
- /// can lock on it without deriving
+ /// can lock on it without deriving
/// from this base.
internal Lock ValuesLock { get; } = new();
@@ -52,13 +52,13 @@ public async ValueTask SubscribeSourcesAsync(CancellationToken cancellationToken
public ValueTask DisposeAsync() => Lifecycle.DisposeAsync();
///
- /// Forwards an upstream error to the downstream observer; thin shim with the
+ /// Relays an upstream error to the downstream observer; thin shim with the
/// (error, ct) signature that expects.
///
/// The error to forward.
/// Ignored — the lifecycle uses its own dispose token.
/// A ValueTask representing the asynchronous forward.
- internal ValueTask OnErrorResume(Exception error, CancellationToken cancellationToken)
+ internal ValueTask RelaySourceErrorAsync(Exception error, CancellationToken cancellationToken)
{
_ = cancellationToken;
return Lifecycle.OnErrorResumeAsync(error);
@@ -67,7 +67,7 @@ internal ValueTask OnErrorResume(Exception error, CancellationToken cancellation
///
/// Reads the per-arity Optional slots, projects them through the selector when every source
/// has produced a value, and forwards the result downstream via the lifecycle. Invoked by
- /// after a per-source OnNext has
+ /// after a per-source OnNext has
/// landed under .
///
/// A ValueTask representing the asynchronous emit.
@@ -75,7 +75,7 @@ internal ValueTask OnErrorResume(Exception error, CancellationToken cancellation
///
/// Subscribes to a single source by 0-based index. Implemented per-arity by the derived
- /// CombineLatestSubscription with a typed switch dispatch over the bundled sources.
+ /// CombineLatestCoordinator with a typed switch dispatch over the bundled sources.
///
/// 0-based source index.
/// A token to cancel the subscription.
diff --git a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedObserver.cs b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedWitness.cs
similarity index 91%
rename from src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedObserver.cs
rename to src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedWitness.cs
index c23940b..b9ae6ad 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedObserver.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestIndexedWitness.cs
@@ -8,19 +8,19 @@ namespace ReactiveUI.Primitives.Async.Internals;
/// Per-source used by every CombineLatestN subscription. The
/// per-arity class previously declared N hand-rolled OnNextN / OnCompletedN method
/// pairs whose bodies differed only in which Optional<TN> field they wrote and which
-/// completion bit they passed to the lifecycle. Pre-building N of these observers at subscription
+/// completion bit they passed to the lifecycle. Pre-building N of these witnesses at subscription
/// time keeps the typing exact and eliminates the per-source method declarations from the per-arity
/// files. The closure cost (one delegate per source for the value-write) is paid once at subscribe
/// and not per emission; the actual per-emission cost is one indirect delegate invoke under the
/// values-lock.
///
-/// The element type of the upstream source this observer subscribes to.
+/// The element type of the upstream source this witness subscribes to.
/// The downstream element type owned by the parent subscription.
/// The parent subscription that owns the values-lock and lifecycle.
/// The completion bitmask bit owned by this source (1 << index).
/// Stores the freshly-emitted value into the parent's typed _valN slot.
-internal sealed class CombineLatestIndexedObserver(
- CombineLatestSubscriptionBase parent,
+internal sealed class CombineLatestIndexedWitness(
+ CombineLatestCoordinatorBase parent,
int sourceBit,
Action recordValue) : ObserverAsync
{
diff --git a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestLifecycle.cs b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestLifecycle.cs
index 50523a6..6f9d63b 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/CombineLatestLifecycle.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/CombineLatestLifecycle.cs
@@ -6,7 +6,7 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
/// Shared subscription lifecycle for the arity-specific CombineLatestN operators (2..16) and
-/// the enumerable variant. Each per-arity CombineLatestSubscription composes one instance of
+/// the enumerable variant. Each per-arity CombineLatestCoordinator composes one instance of
/// this class (has-a, not is-a) and forwards lifecycle / error / gating work into it, so the
/// previously-duplicated infrastructure (gate, dispose CTS, external-link registration, observer
/// fan-out, completion-bitmask handling) lives in one place.
@@ -15,7 +15,7 @@ namespace ReactiveUI.Primitives.Async.Internals;
internal sealed class CombineLatestLifecycle : IAsyncDisposable
{
/// Serializes downstream notifications so OnNext / OnError / OnCompleted never overlap.
- private readonly AsyncGate _gate = new();
+ private readonly AsyncSerialGate _gate = new();
/// Cancellation source for subscription disposal; cancelled exactly once.
private readonly CancellationTokenSource _disposeCts = new();
@@ -59,7 +59,7 @@ public CombineLatestLifecycle(IObserverAsync observer, int sourceCount)
public IAsyncDisposable?[] Subscriptions { get; }
/// Gets a value indicating whether disposal has been signalled.
- public bool IsDisposed => DisposalHelper.IsDisposed(_disposed);
+ public bool HasDisposed => DisposalHelper.HasDisposed(_disposed);
///
/// Links the original subscribe-time cancellation token into this subscription's dispose chain so
@@ -92,9 +92,9 @@ public void LinkExternalCancellation(CancellationToken external)
/// A ValueTask representing the asynchronous forward.
public async ValueTask OnErrorResumeAsync(Exception error)
{
- using (await _gate.LockAsync(DisposeToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(DisposeToken).ConfigureAwait(false))
{
- if (IsDisposed)
+ if (HasDisposed)
{
return;
}
@@ -110,9 +110,9 @@ public async ValueTask OnErrorResumeAsync(Exception error)
/// A ValueTask representing the asynchronous emit.
public async ValueTask EmitDownstreamAsync(TResult value)
{
- using (await _gate.LockAsync(DisposeToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(DisposeToken).ConfigureAwait(false))
{
- if (IsDisposed)
+ if (HasDisposed)
{
return;
}
@@ -133,7 +133,7 @@ public ValueTask OnSourceCompletedAsync(Result result, int doneBit)
{
if (result.IsFailure)
{
- return CompleteAsync(result);
+ return FinishAsync(result);
}
int updated;
@@ -148,14 +148,14 @@ public ValueTask OnSourceCompletedAsync(Result result, int doneBit)
/// Disposes the lifecycle without signalling a terminal notification.
/// A ValueTask representing the asynchronous teardown.
- public ValueTask DisposeAsync() => CompleteAsync(null);
+ public ValueTask DisposeAsync() => FinishAsync(null);
///
/// Completes the combined sequence and disposes every source subscription.
///
/// The completion result, or when disposing without signaling.
/// A ValueTask representing the asynchronous teardown.
- public async ValueTask CompleteAsync(Result? result)
+ public async ValueTask FinishAsync(Result? result)
{
if (DisposalHelper.TrySetDisposed(ref _disposed))
{
diff --git a/src/ReactiveUI.Primitives.Async/Internals/DisposalHelper.cs b/src/ReactiveUI.Primitives.Async/Internals/DisposalHelper.cs
index fc051f3..d23b7f1 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/DisposalHelper.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/DisposalHelper.cs
@@ -19,7 +19,7 @@ internal static class DisposalHelper
/// The disposed flag value.
/// if disposed; otherwise .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static bool IsDisposed(int disposed) => disposed == 1;
+ internal static bool HasDisposed(int disposed) => disposed == 1;
///
/// Atomically sets the disposed flag and returns whether it was already set.
diff --git a/src/ReactiveUI.Primitives.Async/Internals/MulticastSignalAsync.cs b/src/ReactiveUI.Primitives.Async/Internals/MulticastSignalAsync.cs
index 0823a70..e4f3f58 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/MulticastSignalAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/MulticastSignalAsync.cs
@@ -26,7 +26,7 @@ internal sealed class MulticastSignalAsync(IObservableAsync source, ISigna
///
/// The asynchronous gate used to synchronize connection and disconnection operations.
///
- private readonly AsyncGate _gate = new();
+ private readonly AsyncSerialGate _gate = new();
///
/// The current connection subscription, or if not connected.
@@ -71,7 +71,7 @@ public override async ValueTask ConnectAsync(CancellationToken
try
{
- using (await _gate.LockAsync(token).ConfigureAwait(false))
+ using (await _gate.EnterAsync(token).ConfigureAwait(false))
{
if (_connection != null)
{
@@ -85,7 +85,7 @@ await connection.SetDisposableAsync(await source.SubscribeAsync(
token).ConfigureAwait(false)).ConfigureAwait(false);
return DisposableAsync.Create(async () =>
{
- using (await _gate.LockAsync(DisposedCancellationToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(DisposedCancellationToken).ConfigureAwait(false))
{
if (connection is null)
{
@@ -144,7 +144,7 @@ protected override ValueTask SubscribeAsyncCore(
// linked-CTS allocation that the downstream's TryEnter would otherwise produce. The wrap
// itself benefits from SignalAsyncObserver forwarding CancellationToken.None to the
// signal (the wrap's TryEnter sees None and fast-paths), so no wrap-side link is needed.
- var wrap = new WrappedObserverAsync(observer);
+ var wrap = new RelayWitnessAsync(observer);
if (observer is ObserverAsync downstream)
{
downstream.LinkUpstreamCancellation(wrap.InternalDisposedToken);
diff --git a/src/ReactiveUI.Primitives.Async/Internals/WrappedObserverAsync.cs b/src/ReactiveUI.Primitives.Async/Internals/RelayWitnessAsync.cs
similarity index 61%
rename from src/ReactiveUI.Primitives.Async/Internals/WrappedObserverAsync.cs
rename to src/ReactiveUI.Primitives.Async/Internals/RelayWitnessAsync.cs
index 77bde0a..3fc816c 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/WrappedObserverAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/RelayWitnessAsync.cs
@@ -1,15 +1,15 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
namespace ReactiveUI.Primitives.Async.Internals;
///
-/// Wraps an to provide base observer behavior while delegating all notifications.
+/// Relays notifications from the base observer pipeline to another asynchronous observer.
///
-/// The type of elements received by the observer.
-/// The inner observer to delegate notifications to.
-internal sealed class WrappedObserverAsync(IObserverAsync observer) : ObserverAsync
+/// The type of elements received by the witness.
+/// The witness that receives the relayed notifications.
+internal sealed class RelayWitnessAsync(IObserverAsync observer) : ObserverAsync
{
///
protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken) =>
diff --git a/src/ReactiveUI.Primitives.Async/Internals/SingleElementObserver.cs b/src/ReactiveUI.Primitives.Async/Internals/SingleElementWitness.cs
similarity index 85%
rename from src/ReactiveUI.Primitives.Async/Internals/SingleElementObserver.cs
rename to src/ReactiveUI.Primitives.Async/Internals/SingleElementWitness.cs
index 8dc75f8..c3a1fa1 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/SingleElementObserver.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/SingleElementWitness.cs
@@ -19,11 +19,11 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
/// The value to return on empty when is false.
/// A cancellation token for the operation.
-internal sealed class SingleElementObserver(
+internal sealed class SingleElementWitness(
Func? predicate,
bool requireExactlyOne,
T? defaultValue,
- CancellationToken cancellationToken) : TaskObserverAsyncBase(cancellationToken)
+ CancellationToken cancellationToken) : TaskResultWitnessAsyncBase(cancellationToken)
{
/// A value indicating whether a matching element has been found.
private bool _hasValue;
@@ -44,7 +44,7 @@ protected override async ValueTask OnNextAsyncCore(T value, CancellationToken ca
var message = predicate is null
? "Sequence contains more than one element."
: "Sequence contains more than one matching element.";
- await TrySetException(new InvalidOperationException(message)).ConfigureAwait(false);
+ await SetExceptionAndDisposeAsync(new InvalidOperationException(message)).ConfigureAwait(false);
return;
}
@@ -54,14 +54,14 @@ protected override async ValueTask OnNextAsyncCore(T value, CancellationToken ca
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result)
{
if (!result.IsSuccess)
{
- return TrySetException(result.Exception);
+ return SetExceptionAndDisposeAsync(result.Exception);
}
if (!_hasValue && requireExactlyOne)
@@ -69,9 +69,9 @@ protected override ValueTask OnCompletedAsyncCore(Result result)
var message = predicate is null
? "Sequence contains no elements."
: "Sequence contains no matching elements.";
- return TrySetException(new InvalidOperationException(message));
+ return SetExceptionAndDisposeAsync(new InvalidOperationException(message));
}
- return TrySetCompleted(_value);
+ return SetResultAndDisposeAsync(_value);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Internals/TakeUntilLifecycle.cs b/src/ReactiveUI.Primitives.Async/Internals/TakeUntilLifecycle.cs
index f305e46..2c874b1 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/TakeUntilLifecycle.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/TakeUntilLifecycle.cs
@@ -19,7 +19,7 @@ internal sealed class TakeUntilLifecycle : IAsyncDisposable
private readonly CancellationTokenSource _cts = new();
/// Serializes downstream notifications so OnNext / OnError / OnCompleted never overlap.
- private readonly AsyncGate _gate = new();
+ private readonly AsyncSerialGate _gate = new();
/// The downstream observer that receives values, errors, and the terminal completion.
private readonly IObserverAsync _observer;
@@ -67,9 +67,9 @@ public void LinkExternalCancellation(CancellationToken external)
/// Forwards a value to the downstream observer under the serialization gate.
/// The value to forward.
/// A ValueTask representing the asynchronous forward.
- public async ValueTask ForwardOnNextAsync(T value)
+ public async ValueTask RelayNextAsync(T value)
{
- using (await _gate.LockAsync(DisposeToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(DisposeToken).ConfigureAwait(false))
{
await _observer.OnNextAsync(value, DisposeToken).ConfigureAwait(false);
}
@@ -78,9 +78,9 @@ public async ValueTask ForwardOnNextAsync(T value)
/// Forwards a non-terminal error to the downstream observer under the serialization gate.
/// The error to forward.
/// A ValueTask representing the asynchronous forward.
- public async ValueTask ForwardOnErrorResumeAsync(Exception error)
+ public async ValueTask RelayErrorAsync(Exception error)
{
- using (await _gate.LockAsync(DisposeToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(DisposeToken).ConfigureAwait(false))
{
await _observer.OnErrorResumeAsync(error, DisposeToken).ConfigureAwait(false);
}
@@ -89,9 +89,9 @@ public async ValueTask ForwardOnErrorResumeAsync(Exception error)
/// Forwards the completion signal to the downstream observer under the serialization gate.
/// The completion result.
/// A ValueTask representing the asynchronous forward.
- public async ValueTask ForwardOnCompletedAsync(Result result)
+ public async ValueTask RelayCompletionAsync(Result result)
{
- using (await _gate.LockAsync().ConfigureAwait(false))
+ using (await _gate.EnterAsync().ConfigureAwait(false))
{
await _observer.OnCompletedAsync(result).ConfigureAwait(false);
}
diff --git a/src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceObserver.cs b/src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceWitness.cs
similarity index 82%
rename from src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceObserver.cs
rename to src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceWitness.cs
index 72a2a19..a0c857d 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceObserver.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/TakeUntilSourceWitness.cs
@@ -12,23 +12,23 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
/// The downstream element type.
/// The shared lifecycle owning the gate and forwarding logic.
-internal sealed class TakeUntilSourceObserver(TakeUntilLifecycle lifecycle) : ObserverAsync
+internal sealed class TakeUntilSourceWitness(TakeUntilLifecycle lifecycle) : ObserverAsync
{
///
protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken)
{
_ = cancellationToken;
- return lifecycle.ForwardOnNextAsync(value);
+ return lifecycle.RelayNextAsync(value);
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken)
{
_ = cancellationToken;
- return lifecycle.ForwardOnErrorResumeAsync(error);
+ return lifecycle.RelayErrorAsync(error);
}
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- lifecycle.ForwardOnCompletedAsync(result);
+ lifecycle.RelayCompletionAsync(result);
}
diff --git a/src/ReactiveUI.Primitives.Async/Internals/TaskObserverAsyncBase.cs b/src/ReactiveUI.Primitives.Async/Internals/TaskResultWitnessAsyncBase.cs
similarity index 80%
rename from src/ReactiveUI.Primitives.Async/Internals/TaskObserverAsyncBase.cs
rename to src/ReactiveUI.Primitives.Async/Internals/TaskResultWitnessAsyncBase.cs
index 2dd81bf..485be39 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/TaskObserverAsyncBase.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/TaskResultWitnessAsyncBase.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -7,12 +7,12 @@
namespace ReactiveUI.Primitives.Async.Internals;
///
-/// Base class for observers that produce a single task-based result value when the observed sequence completes.
+/// Base class for witnesses that produce a single task-based result value when the observed sequence completes.
///
/// The type of elements received from the observable sequence.
-/// The type of the result value produced by this observer.
+/// The type of the result value produced by this witness.
/// A cancellation token used to cancel the waiting operation.
-internal abstract class TaskObserverAsyncBase(CancellationToken cancellationToken) : ObserverAsync
+internal abstract class TaskResultWitnessAsyncBase(CancellationToken cancellationToken) : ObserverAsync
{
///
/// The task completion source used to produce the observer's single result value.
@@ -28,7 +28,7 @@ internal abstract class TaskObserverAsyncBase(CancellationToken c
/// Asynchronously waits for the observer to produce its result value.
///
/// A task representing the asynchronous operation, containing the result value.
- public async ValueTask WaitValueAsync()
+ public async ValueTask AwaitResultAsync()
{
try
{
@@ -36,7 +36,7 @@ public async ValueTask WaitValueAsync()
await using var ct = _cancellationToken.Register(
static x =>
{
- var @this = (TaskObserverAsyncBase)x!;
+ var @this = (TaskResultWitnessAsyncBase)x!;
@this._tcs.TrySetException(new OperationCanceledException(@this._cancellationToken));
},
this);
@@ -44,7 +44,7 @@ public async ValueTask WaitValueAsync()
using var ct = _cancellationToken.Register(
static x =>
{
- var @this = (TaskObserverAsyncBase)x!;
+ var @this = (TaskResultWitnessAsyncBase)x!;
@this._tcs.TrySetException(new OperationCanceledException(@this._cancellationToken));
},
this);
@@ -64,7 +64,7 @@ public async ValueTask WaitValueAsync()
/// The result value to set.
/// A task representing the asynchronous operation.
[DebuggerStepThrough]
- protected async ValueTask TrySetCompleted(TTaskValue value)
+ protected async ValueTask SetResultAndDisposeAsync(TTaskValue value)
{
try
{
@@ -81,7 +81,7 @@ protected async ValueTask TrySetCompleted(TTaskValue value)
///
/// The exception that caused the fault.
/// A task representing the asynchronous operation.
- protected async ValueTask TrySetException(Exception e)
+ protected async ValueTask SetExceptionAndDisposeAsync(Exception e)
{
try
{
diff --git a/src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription.cs b/src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription.cs
similarity index 50%
rename from src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription.cs
rename to src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription.cs
index 1b4d1af..ce57362 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -7,21 +7,21 @@ namespace ReactiveUI.Primitives.Async.Internals;
///
/// Provides factory methods for creating and starting cancelable task-based subscriptions.
///
-internal static class CancelableTaskSubscription
+internal static class TaskSignalSubscription
{
///
/// Creates and immediately starts a new cancelable task subscription.
///
/// The type of the elements observed by the subscription.
- /// The asynchronous function that defines the subscription logic.
+ /// The asynchronous function that defines the subscription logic.
/// The observer that receives notifications.
- /// A running instance.
- public static CancelableTaskSubscription CreateAndStart(
- Func, CancellationToken, ValueTask> runAsyncCore,
+ /// A running instance.
+ public static TaskSignalSubscription StartNew(
+ Func, CancellationToken, ValueTask> executeAsyncCore,
IObserverAsync observer)
{
- var ret = new AnonymousCancelableTaskSubscription(runAsyncCore, observer);
- ret.Run();
+ var ret = new AnonymousTaskSignalSubscription(executeAsyncCore, observer);
+ ret.Start();
return ret;
}
@@ -29,14 +29,14 @@ public static CancelableTaskSubscription CreateAndStart(
/// A cancelable task subscription that delegates its core logic to a user-supplied function.
///
/// The type of the elements observed by the subscription.
- /// The asynchronous function that defines the subscription logic.
+ /// The asynchronous function that defines the subscription logic.
/// The observer that receives notifications.
- internal sealed class AnonymousCancelableTaskSubscription(
- Func, CancellationToken, ValueTask> runAsyncCore,
- IObserverAsync observer) : CancelableTaskSubscription(observer)
+ internal sealed class AnonymousTaskSignalSubscription(
+ Func, CancellationToken, ValueTask> executeAsyncCore,
+ IObserverAsync observer) : TaskSignalSubscription(observer)
{
///
- protected override ValueTask RunAsyncCore(IObserverAsync observer, CancellationToken cancellationToken) =>
- runAsyncCore(observer, cancellationToken);
+ protected override ValueTask ExecuteAsyncCore(IObserverAsync observer, CancellationToken cancellationToken) =>
+ executeAsyncCore(observer, cancellationToken);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription{T}.cs b/src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription{T}.cs
similarity index 83%
rename from src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription{T}.cs
rename to src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription{T}.cs
index 8b5e9b8..961a0ae 100644
--- a/src/ReactiveUI.Primitives.Async/Internals/CancelableTaskSubscription{T}.cs
+++ b/src/ReactiveUI.Primitives.Async/Internals/TaskSignalSubscription{T}.cs
@@ -11,10 +11,10 @@ namespace ReactiveUI.Primitives.Async.Internals;
/// This type provides a base for implementing cancellable, asynchronously disposable
/// subscriptions that coordinate observer notifications and resource cleanup. Disposal cancels any ongoing
/// operations and ensures that all resources are released before completion. Derived classes should implement the
-/// core execution logic in RunCoreAsync.
+/// core execution logic in .
/// The type of the elements observed by the subscription.
/// The observer that receives notifications for the subscription. Cannot be null.
-internal abstract class CancelableTaskSubscription(IObserverAsync observer) : IAsyncDisposable
+internal abstract class TaskSignalSubscription(IObserverAsync observer) : IAsyncDisposable
{
///
/// The task completion source used to signal when the subscription's asynchronous operation has finished.
@@ -26,13 +26,13 @@ internal abstract class CancelableTaskSubscription(IObserverAsync observer
///
private readonly CancellationTokenSource _cts = new();
- /// Managed-thread ID of the thread currently inside , or
+ /// Managed-thread ID of the thread currently inside , or
/// 0 when no run is in flight. Replaces an -based
/// reentry flag — the AsyncLocal cloned
- /// on every set, costing ~80 B per Run. Thread-ID detection is exact for the
+ /// on every set, costing ~80 B per execution. Thread-ID detection is exact for the
/// synchronous-reentry deadlock case (Dispose called from within the same call stack
- /// as RunAsync); asynchronous reentry after a thread hop may return from Dispose
- /// slightly before RunAsync's finally fires, but cancellation has already been
+ /// as ); asynchronous reentry after a thread hop may return from Dispose
+ /// slightly before 's finally fires, but cancellation has already been
/// signalled so no observer notifications race the dispose.
private int _runningThreadId;
@@ -46,9 +46,9 @@ internal abstract class CancelableTaskSubscription(IObserverAsync observer
///
/// This method initiates the asynchronous operation and does not wait for its completion. To
/// monitor progress or handle completion, use the asynchronous counterpart directly. The
- /// returned by is converted to a
+ /// returned by is converted to a
/// before being discarded so the fire-and-forget pattern stays compatible with CA2012.
- public void Run() => _ = RunAsync(_cts.Token).AsTask();
+ public void Start() => _ = ExecuteAsync(_cts.Token).AsTask();
///
/// Asynchronously releases the resources used by the object and cancels any ongoing operations.
@@ -88,7 +88,7 @@ internal static async ValueTask CompleteWithFailureAsync(IObserverAsync obser
}
catch (Exception exception)
{
- UnhandledExceptionHandler.OnUnhandledException(exception);
+ UnhandledExceptionHandler.ReportUnhandledException(exception);
}
}
@@ -97,12 +97,12 @@ internal static async ValueTask CompleteWithFailureAsync(IObserverAsync obser
///
/// A cancellation token that can be used to cancel the operation.
/// A representing the asynchronous operation.
- internal async ValueTask RunAsync(CancellationToken cancellationToken)
+ internal async ValueTask ExecuteAsync(CancellationToken cancellationToken)
{
Volatile.Write(ref _runningThreadId, Environment.CurrentManagedThreadId);
try
{
- await RunAsyncCore(observer, cancellationToken).ConfigureAwait(false);
+ await ExecuteAsyncCore(observer, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
@@ -121,5 +121,5 @@ internal async ValueTask RunAsync(CancellationToken cancellationToken)
/// The observer that receives notifications.
/// A cancellation token that can be used to cancel the operation.
/// A representing the asynchronous operation.
- protected abstract ValueTask RunAsyncCore(IObserverAsync observer, CancellationToken cancellationToken);
+ protected abstract ValueTask ExecuteAsyncCore(IObserverAsync observer, CancellationToken cancellationToken);
}
diff --git a/src/ReactiveUI.Primitives.Async/Mixins/AsyncContextMixins.cs b/src/ReactiveUI.Primitives.Async/Mixins/AsyncContextMixins.cs
index 9e4070d..c6617f2 100644
--- a/src/ReactiveUI.Primitives.Async/Mixins/AsyncContextMixins.cs
+++ b/src/ReactiveUI.Primitives.Async/Mixins/AsyncContextMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -31,7 +31,7 @@ public static bool IsSameAsCurrentAsyncContext(this AsyncContext @this)
if (@this.Sequencer is not null)
{
- return TaskScheduler.Current is AsyncContext.SchedulerTaskScheduler adapter &&
+ return TaskScheduler.Current is AsyncContext.SequencerTaskScheduler adapter &&
ReferenceEquals(adapter.Sequencer, @this.Sequencer);
}
diff --git a/src/ReactiveUI.Primitives.Async/Observables/Create.cs b/src/ReactiveUI.Primitives.Async/Observables/Create.cs
index 3975eac..6653828 100644
--- a/src/ReactiveUI.Primitives.Async/Observables/Create.cs
+++ b/src/ReactiveUI.Primitives.Async/Observables/Create.cs
@@ -33,7 +33,7 @@ public static IObservableAsync Create(
Func, CancellationToken, ValueTask> subscribeAsync) =>
subscribeAsync is null
? throw new ArgumentNullException(nameof(subscribeAsync))
- : new AnonymousSignalAsync(subscribeAsync);
+ : new CallbackSignalAsync(subscribeAsync);
///
/// Creates a new observable sequence that runs the specified asynchronous job as a background task.
@@ -44,7 +44,7 @@ subscribeAsync is null
/// An SignalAsync{T} that represents the observable sequence produced by the background job.
public static IObservableAsync CreateAsBackgroundJob(
Func, CancellationToken, ValueTask> job) =>
- CreateAsBackgroundJob(job, false, null);
+ CreateBackgroundJobSignal(job, false, null);
///
/// Creates a new observable sequence that runs the specified asynchronous job as a background task.
@@ -58,7 +58,7 @@ public static IObservableAsync CreateAsBackgroundJob(
public static IObservableAsync CreateAsBackgroundJob(
Func, CancellationToken, ValueTask> job,
bool startSynchronously) =>
- CreateAsBackgroundJob(job, startSynchronously, null);
+ CreateBackgroundJobSignal(job, startSynchronously, null);
///
/// Creates a new observable sequence that runs the specified asynchronous job as a background task using the
@@ -72,7 +72,7 @@ public static IObservableAsync CreateAsBackgroundJob(
public static IObservableAsync CreateAsBackgroundJob(
Func, CancellationToken, ValueTask> job,
TaskScheduler taskScheduler) =>
- CreateAsBackgroundJob(job, false, taskScheduler);
+ CreateBackgroundJobSignal(job, false, taskScheduler);
///
/// Creates a new observable sequence that runs the specified asynchronous job as a background task,
@@ -83,7 +83,7 @@ public static IObservableAsync CreateAsBackgroundJob(
/// true to start the job synchronously; otherwise, false.
/// An optional task scheduler for scheduling the job, or to use the default.
/// An observable that emits values produced by the background job.
- private static IObservableAsync CreateAsBackgroundJob(
+ private static IObservableAsync CreateBackgroundJobSignal(
Func, CancellationToken, ValueTask> job,
bool startSynchronously,
TaskScheduler? taskScheduler)
@@ -92,12 +92,12 @@ private static IObservableAsync CreateAsBackgroundJob(
if (startSynchronously)
{
- return Create((observer, _) => new(CancelableTaskSubscription.CreateAndStart(job, observer)));
+ return Create((observer, _) => new(TaskSignalSubscription.StartNew(job, observer)));
}
if (taskScheduler is null)
{
- return Create((observer, _) => new(CancelableTaskSubscription.CreateAndStart(
+ return Create((observer, _) => new(TaskSignalSubscription.StartNew(
async (obs, token) =>
{
await Task.Yield();
@@ -106,7 +106,7 @@ private static IObservableAsync CreateAsBackgroundJob(
observer)));
}
- return Create((observer, _) => new(CancelableTaskSubscription.CreateAndStart(
+ return Create((observer, _) => new(TaskSignalSubscription.StartNew(
async (obs, ct) => await Task.Factory.StartNew(
() => job(obs, ct).AsTask(),
ct,
diff --git a/src/ReactiveUI.Primitives.Async/Observables/Return.cs b/src/ReactiveUI.Primitives.Async/Observables/Return.cs
index 6e1d1df..619baf6 100644
--- a/src/ReactiveUI.Primitives.Async/Observables/Return.cs
+++ b/src/ReactiveUI.Primitives.Async/Observables/Return.cs
@@ -27,7 +27,7 @@ public static partial class SignalAsync
///
/// Single-value observable that captures the emitted value as a field and routes through a typed
- /// . Same deferred-emit semantic as the previous
+ /// . Same deferred-emit semantic as the previous
/// CreateAsBackgroundJob path, but without the per-call Func closure allocation.
///
/// The element type emitted.
@@ -40,17 +40,17 @@ protected override ValueTask SubscribeAsyncCore(
CancellationToken cancellationToken)
{
var subscription = new ReturnSubscription(observer, value);
- subscription.Run();
+ subscription.Start();
return new(subscription);
}
/// Per-subscription task body that emits the captured value and signals completion.
/// The downstream observer.
/// The captured value.
- private sealed class ReturnSubscription(IObserverAsync observer, T value) : CancelableTaskSubscription(observer)
+ private sealed class ReturnSubscription(IObserverAsync observer, T value) : TaskSignalSubscription(observer)
{
///
- protected override async ValueTask RunAsyncCore(IObserverAsync downstream, CancellationToken cancellationToken)
+ protected override async ValueTask ExecuteAsyncCore(IObserverAsync downstream, CancellationToken cancellationToken)
{
await downstream.OnNextAsync(value, cancellationToken).ConfigureAwait(false);
await downstream.OnCompletedAsync(Result.Success).ConfigureAwait(false);
diff --git a/src/ReactiveUI.Primitives.Async/ObserverAsync.cs b/src/ReactiveUI.Primitives.Async/ObserverAsync.cs
index 58e9867..8ad82f5 100644
--- a/src/ReactiveUI.Primitives.Async/ObserverAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/ObserverAsync.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
+// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -79,7 +79,7 @@ protected ObserverAsync()
///
/// Gets a value indicating whether this observer has been disposed.
///
- internal bool IsDisposed => Volatile.Read(ref _disposed) != 0;
+ internal bool HasDisposed => Volatile.Read(ref _disposed) != 0;
///
/// Gets the cancellation token that fires when this observer disposes. Exposed for sibling operators
@@ -142,11 +142,11 @@ public ValueTask OnErrorResumeAsync(Exception error, CancellationToken cancellat
return default;
}
- // OnErrorResumeAsync_Private is an async ValueTask method — any sync or async exception
+ // RouteObserverErrorAsync is an async ValueTask method — any sync or async exception
// it raises is captured into the returned ValueTask and surfaces through the await in
// OnErrorResumeAsyncSlow. A try/catch around the invocation expression itself would be
// dead code in modern C# async semantics.
- var core = OnErrorResumeAsync_Private(error, scope.Token);
+ var core = RouteObserverErrorAsync(error, scope.Token);
if (core.IsCompletedSuccessfully)
{
@@ -181,7 +181,7 @@ public ValueTask OnCompletedAsync(Result result)
}
catch (Exception e)
{
- UnhandledExceptionHandler.OnUnhandledException(e);
+ UnhandledExceptionHandler.ReportUnhandledException(e);
scope.Dispose();
return CompleteOrChainDispose();
}
@@ -216,8 +216,8 @@ public async ValueTask DisposeAsync()
///
/// The source subscription to track, or to clear it.
/// A representing the asynchronous operation.
- internal ValueTask SetSourceSubscriptionAsync(IAsyncDisposable? value) =>
- SingleAssignmentDisposableAsync.SetDisposableAsync(ref _sourceSubscription, value);
+ internal ValueTask AssignSourceSubscriptionAsync(IAsyncDisposable? value) =>
+ SingleAssignmentDisposableAsync.AssignDisposableAsync(ref _sourceSubscription, value);
///
/// Internal wrapper around so sibling operators
@@ -257,7 +257,7 @@ internal bool TryEnterOnSomethingCall(CancellationToken cancellationToken, out L
// are legal — only cross-thread overlap fires the exception.
if (oldCount > 0 && oldThreadId != currentThreadId)
{
- UnhandledExceptionHandler.OnUnhandledException(new ConcurrentObserverCallsException());
+ UnhandledExceptionHandler.ReportUnhandledException(new ConcurrentObserverCallsException());
scope = default;
return false;
}
@@ -321,13 +321,13 @@ internal bool ExitOnSomethingCall()
/// The exception that triggered error handling.
/// A cancellation token for the operation.
/// A task representing the asynchronous operation.
- internal async ValueTask OnErrorResumeAsync_Private(Exception error, CancellationToken cancellationToken)
+ internal async ValueTask RouteObserverErrorAsync(Exception error, CancellationToken cancellationToken)
{
try
{
if (cancellationToken.IsCancellationRequested)
{
- UnhandledExceptionHandler.OnUnhandledException(error);
+ UnhandledExceptionHandler.ReportUnhandledException(error);
return;
}
@@ -335,11 +335,11 @@ internal async ValueTask OnErrorResumeAsync_Private(Exception error, Cancellatio
}
catch (OperationCanceledException)
{
- UnhandledExceptionHandler.OnUnhandledException(error);
+ UnhandledExceptionHandler.ReportUnhandledException(error);
}
catch (Exception e)
{
- UnhandledExceptionHandler.OnUnhandledException(e);
+ UnhandledExceptionHandler.ReportUnhandledException(e);
}
}
@@ -493,7 +493,7 @@ private async ValueTask CompleteDisposeAfterCancelAsync(Task? allOnSomethingCall
}
catch (Exception e)
{
- UnhandledExceptionHandler.OnUnhandledException(e);
+ UnhandledExceptionHandler.ReportUnhandledException(e);
}
}
@@ -525,7 +525,7 @@ private async ValueTask OnNextAsyncSlow(ValueTask core, LinkedTokenScope scope)
}
catch (Exception e)
{
- await OnErrorResumeAsync_Private(e, scope.Token).ConfigureAwait(false);
+ await RouteObserverErrorAsync(e, scope.Token).ConfigureAwait(false);
}
finally
{
@@ -536,7 +536,7 @@ private async ValueTask OnNextAsyncSlow(ValueTask core, LinkedTokenScope scope)
///
/// Async continuation for when threw synchronously.
- /// Routes the error through off the fast path so the
+ /// Routes the error through off the fast path so the
/// caller-visible stays state-machine free in the common case.
///
/// The exception thrown by the core.
@@ -546,7 +546,7 @@ private async ValueTask OnNextAsyncSlowAfterSyncThrow(Exception error, LinkedTok
{
try
{
- await OnErrorResumeAsync_Private(error, scope.Token).ConfigureAwait(false);
+ await RouteObserverErrorAsync(error, scope.Token).ConfigureAwait(false);
}
finally
{
@@ -590,7 +590,7 @@ private async ValueTask OnCompletedAsyncSlow(ValueTask core, LinkedTokenScope sc
}
catch (Exception e)
{
- UnhandledExceptionHandler.OnUnhandledException(e);
+ UnhandledExceptionHandler.ReportUnhandledException(e);
}
finally
{
diff --git a/src/ReactiveUI.Primitives.Async/Operators/AggregateAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/AggregateAsync.cs
index 2e24def..bcc75bd 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/AggregateAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/AggregateAsync.cs
@@ -55,9 +55,9 @@ public static async ValueTask AggregateAsync(
ArgumentExceptionHelper.ThrowIfNull(accumulator);
cancellationToken.ThrowIfCancellationRequested();
- var observer = new AggregateAsyncObserver(seed, accumulator, cancellationToken);
+ var observer = new AggregateTaskWitness(seed, accumulator, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -160,10 +160,10 @@ public static async ValueTask AggregateAsync(
/// The initial accumulator value.
/// The asynchronous accumulator function.
/// A cancellation token for the operation.
- internal sealed class AggregateAsyncObserver(
+ internal sealed class AggregateTaskWitness(
TAcc seed,
Func> accumulator,
- CancellationToken cancellationToken) : TaskObserverAsyncBase(cancellationToken)
+ CancellationToken cancellationToken) : TaskResultWitnessAsyncBase(cancellationToken)
{
///
/// The current accumulated value.
@@ -176,10 +176,10 @@ protected override async ValueTask OnNextAsyncCore(T value, CancellationToken ca
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- result.IsSuccess ? TrySetCompleted(_acc) : TrySetException(result.Exception);
+ result.IsSuccess ? SetResultAndDisposeAsync(_acc) : SetExceptionAndDisposeAsync(result.Exception);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/AnyAllAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/AnyAllAsync.cs
index 13e101f..6249eb6 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/AnyAllAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/AnyAllAsync.cs
@@ -29,9 +29,9 @@ public static partial class SignalAsync
public static async ValueTask AnyAsync(this IObservableAsync @this, Func? predicate, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new AnyAsyncObserver(predicate, cancellationToken);
+ var observer = new AnyTaskWitness(predicate, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -84,42 +84,42 @@ public static async ValueTask AllAsync(this IObservableAsync @this,
ArgumentExceptionHelper.ThrowIfNull(predicate);
cancellationToken.ThrowIfCancellationRequested();
- var observer = new AllAsyncObserver(predicate, cancellationToken);
+ var observer = new AllTaskWitness(predicate, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
- /// An observer that determines whether any element in the sequence satisfies a predicate.
+ /// A witness that determines whether any element in the sequence satisfies a predicate.
///
/// The type of elements in the sequence.
- internal sealed class AnyAsyncObserver(Func? predicate, CancellationToken cancellationToken)
- : TaskObserverAsyncBase(cancellationToken)
+ internal sealed class AnyTaskWitness(Func? predicate, CancellationToken cancellationToken)
+ : TaskResultWitnessAsyncBase(cancellationToken)
{
///
protected override async ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken)
{
if (predicate is null || predicate(value))
{
- await TrySetCompleted(true).ConfigureAwait(false);
+ await SetResultAndDisposeAsync(true).ConfigureAwait(false);
}
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- !result.IsSuccess ? TrySetException(result.Exception) : TrySetCompleted(false);
+ !result.IsSuccess ? SetExceptionAndDisposeAsync(result.Exception) : SetResultAndDisposeAsync(false);
}
///
- /// An observer that determines whether all elements in the sequence satisfy a predicate.
+ /// A witness that determines whether all elements in the sequence satisfy a predicate.
///
/// The type of elements in the sequence.
- internal sealed class AllAsyncObserver(Func predicate, CancellationToken cancellationToken)
- : TaskObserverAsyncBase(cancellationToken)
+ internal sealed class AllTaskWitness(Func predicate, CancellationToken cancellationToken)
+ : TaskResultWitnessAsyncBase(cancellationToken)
{
///
/// The predicate function used to test each element in the sequence.
@@ -131,16 +131,16 @@ protected override async ValueTask OnNextAsyncCore(T value, CancellationToken ca
{
if (!_predicate(value))
{
- await TrySetCompleted(false).ConfigureAwait(false);
+ await SetResultAndDisposeAsync(false).ConfigureAwait(false);
}
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- !result.IsSuccess ? TrySetException(result.Exception) : TrySetCompleted(true);
+ !result.IsSuccess ? SetExceptionAndDisposeAsync(result.Exception) : SetResultAndDisposeAsync(true);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/Cast.cs b/src/ReactiveUI.Primitives.Async/Operators/Cast.cs
index a8ab090..7e69c3f 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/Cast.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/Cast.cs
@@ -49,7 +49,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new CastObserver(observer, cancellationToken);
+ var sink = new CastWitness(observer, cancellationToken);
if (observer is ObserverAsync downstreamBase)
{
@@ -57,14 +57,14 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that casts each value to .
- /// The downstream observer.
+ /// Per-subscription witness that casts each value to .
+ /// The downstream witness.
/// The subscribe-time cancellation token.
- internal sealed class CastObserver(
+ internal sealed class CastWitness(
IObserverAsync downstream,
CancellationToken subscribeToken) : ObserverAsync(subscribeToken)
{
diff --git a/src/ReactiveUI.Primitives.Async/Operators/Catch.cs b/src/ReactiveUI.Primitives.Async/Operators/Catch.cs
index 6cf7f7f..176b349 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/Catch.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/Catch.cs
@@ -77,7 +77,7 @@ public static IObservableAsync Catch(
public static IObservableAsync CatchAndIgnoreErrorResume(this IObservableAsync source, Func> handler) =>
source.Catch(handler, static (error, _) =>
{
- UnhandledExceptionHandler.OnUnhandledException(error);
+ UnhandledExceptionHandler.ReportUnhandledException(error);
return default;
});
@@ -101,7 +101,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new CatchObserver(observer, handler, onErrorResume, cancellationToken);
+ var sink = new CatchWitness(observer, handler, onErrorResume, cancellationToken);
// Wire sink's dispose token into the downstream's link chain so the downstream's hot path
// recognises this token without allocating a per-emission linked CTS.
@@ -111,19 +111,19 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that forwards OnNext verbatim, delegates error-resume to the
+ /// Per-subscription witness that forwards OnNext verbatim, delegates error-resume to the
/// supplied callback (or the downstream when none was supplied), and on a failed completion subscribes the
/// handler-produced fallback observable in place of forwarding the failure.
- /// The downstream observer.
+ /// The downstream witness.
/// The fallback factory.
/// Optional async error-resume callback.
/// The subscribe-time cancellation token, linked into the dispose chain and reused for the handler
/// subscription.
- internal sealed class CatchObserver(
+ internal sealed class CatchWitness(
IObserverAsync downstream,
Func> handler,
Func? onErrorResume,
@@ -177,7 +177,7 @@ protected override async ValueTask DisposeAsyncCore()
}
catch (Exception e)
{
- UnhandledExceptionHandler.OnUnhandledException(e);
+ UnhandledExceptionHandler.ReportUnhandledException(e);
}
await base.DisposeAsyncCore().ConfigureAwait(false);
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest10.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest10.cs
index 7512c2c..094126b 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest10.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest10.cs
@@ -116,7 +116,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -127,10 +127,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -169,34 +169,34 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -252,12 +252,12 @@ internal readonly record struct Values(
T10 V10);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest11.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest11.cs
index f18ee15..705bffd 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest11.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest11.cs
@@ -122,7 +122,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -133,10 +133,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -178,37 +178,37 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -269,12 +269,12 @@ internal readonly record struct Values(
T11 V11);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest12.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest12.cs
index 21434fd..570b4ef 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest12.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest12.cs
@@ -128,7 +128,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -139,10 +139,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -187,40 +187,40 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Indexed observer for source 12.
- private readonly CombineLatestIndexedObserver _obs12;
+ private readonly CombineLatestIndexedWitness _obs12;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -286,12 +286,12 @@ internal readonly record struct Values(
T12 V12);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest13.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest13.cs
index 58ed1c6..a1913dd 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest13.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest13.cs
@@ -134,7 +134,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -145,10 +145,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -196,43 +196,43 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Indexed observer for source 12.
- private readonly CombineLatestIndexedObserver _obs12;
+ private readonly CombineLatestIndexedWitness _obs12;
/// Indexed observer for source 13.
- private readonly CombineLatestIndexedObserver _obs13;
+ private readonly CombineLatestIndexedWitness _obs13;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -303,12 +303,12 @@ internal readonly record struct Values(
T13 V13);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest14.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest14.cs
index a24a4e3..68e096f 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest14.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest14.cs
@@ -140,7 +140,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -151,10 +151,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -205,46 +205,46 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Indexed observer for source 12.
- private readonly CombineLatestIndexedObserver _obs12;
+ private readonly CombineLatestIndexedWitness _obs12;
/// Indexed observer for source 13.
- private readonly CombineLatestIndexedObserver _obs13;
+ private readonly CombineLatestIndexedWitness _obs13;
/// Indexed observer for source 14.
- private readonly CombineLatestIndexedObserver _obs14;
+ private readonly CombineLatestIndexedWitness _obs14;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -320,12 +320,12 @@ internal readonly record struct Values(
T14 V14);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest15.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest15.cs
index f831ed1..59e3cdc 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest15.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest15.cs
@@ -146,7 +146,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -157,10 +157,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -214,49 +214,49 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Indexed observer for source 12.
- private readonly CombineLatestIndexedObserver _obs12;
+ private readonly CombineLatestIndexedWitness _obs12;
/// Indexed observer for source 13.
- private readonly CombineLatestIndexedObserver _obs13;
+ private readonly CombineLatestIndexedWitness _obs13;
/// Indexed observer for source 14.
- private readonly CombineLatestIndexedObserver _obs14;
+ private readonly CombineLatestIndexedWitness _obs14;
/// Indexed observer for source 15.
- private readonly CombineLatestIndexedObserver _obs15;
+ private readonly CombineLatestIndexedWitness _obs15;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -337,12 +337,12 @@ internal readonly record struct Values(
T15 V15);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest16.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest16.cs
index ba0c5e5..03d4951 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest16.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest16.cs
@@ -152,7 +152,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -163,10 +163,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -223,52 +223,52 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Indexed observer for source 10.
- private readonly CombineLatestIndexedObserver _obs10;
+ private readonly CombineLatestIndexedWitness _obs10;
/// Indexed observer for source 11.
- private readonly CombineLatestIndexedObserver _obs11;
+ private readonly CombineLatestIndexedWitness _obs11;
/// Indexed observer for source 12.
- private readonly CombineLatestIndexedObserver _obs12;
+ private readonly CombineLatestIndexedWitness _obs12;
/// Indexed observer for source 13.
- private readonly CombineLatestIndexedObserver _obs13;
+ private readonly CombineLatestIndexedWitness _obs13;
/// Indexed observer for source 14.
- private readonly CombineLatestIndexedObserver _obs14;
+ private readonly CombineLatestIndexedWitness _obs14;
/// Indexed observer for source 15.
- private readonly CombineLatestIndexedObserver _obs15;
+ private readonly CombineLatestIndexedWitness _obs15;
/// Indexed observer for source 16.
- private readonly CombineLatestIndexedObserver _obs16;
+ private readonly CombineLatestIndexedWitness _obs16;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -354,12 +354,12 @@ internal readonly record struct Values(
T16 V16);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest2.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest2.cs
index e0a7a6d..a863882 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest2.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest2.cs
@@ -68,7 +68,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -79,10 +79,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -97,10 +97,10 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -116,12 +116,12 @@ internal readonly record struct Values(
T2 V2);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest3.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest3.cs
index 8a2757a..71afc23 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest3.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest3.cs
@@ -74,7 +74,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -85,10 +85,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -106,13 +106,13 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -133,12 +133,12 @@ internal readonly record struct Values(
T3 V3);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest4.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest4.cs
index f736185..2127b4d 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest4.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest4.cs
@@ -80,7 +80,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -91,10 +91,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -115,16 +115,16 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -150,12 +150,12 @@ internal readonly record struct Values(
T4 V4);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest5.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest5.cs
index cd70110..aabea74 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest5.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest5.cs
@@ -86,7 +86,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -97,10 +97,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -124,19 +124,19 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -167,12 +167,12 @@ internal readonly record struct Values(
T5 V5);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest6.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest6.cs
index 7e47634..d286fd7 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest6.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest6.cs
@@ -92,7 +92,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -103,10 +103,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -133,22 +133,22 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -184,12 +184,12 @@ internal readonly record struct Values(
T6 V6);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest7.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest7.cs
index 715a560..b922eac 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest7.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest7.cs
@@ -98,7 +98,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -109,10 +109,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -142,25 +142,25 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -201,12 +201,12 @@ internal readonly record struct Values(
T7 V7);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest8.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest8.cs
index e14d36e..cbfb18a 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest8.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest8.cs
@@ -104,7 +104,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -115,10 +115,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -151,28 +151,28 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -218,12 +218,12 @@ internal readonly record struct Values(
T8 V8);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest9.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest9.cs
index e675c0e..3e0fad2 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatest9.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatest9.cs
@@ -110,7 +110,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new CombineLatestSubscription(observer, sources, selector);
+ var subscription = new CombineLatestCoordinator(observer, sources, selector);
subscription.Lifecycle.LinkExternalCancellation(cancellationToken);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
@@ -121,10 +121,10 @@ protected override ValueTask SubscribeAsyncCore(
/// Per-arity subscription holding the typed Optional slots, the pre-built indexed
/// observers, the SubscribeAtAsync switch, and the selector invocation. Shared scaffolding
/// (gate, lifecycle, ValuesLock, OnErrorResume, SubscribeSourcesAsync, DisposeAsync) lives
- /// in ; the per-source OnNext / OnError /
- /// OnCompleted forwarding lives in .
+ /// in ; the per-source OnNext / OnError /
+ /// OnCompleted forwarding lives in .
///
- internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase
+ internal sealed class CombineLatestCoordinator : CombineLatestCoordinatorBase
{
/// Bit owned by source 1 inside the lifecycle's completion bitmask.
private const int Source1Bit = 1 << 0;
@@ -160,31 +160,31 @@ internal sealed class CombineLatestSubscription : CombineLatestSubscriptionBase<
private readonly Func _selector;
/// Indexed observer for source 1.
- private readonly CombineLatestIndexedObserver _obs1;
+ private readonly CombineLatestIndexedWitness _obs1;
/// Indexed observer for source 2.
- private readonly CombineLatestIndexedObserver _obs2;
+ private readonly CombineLatestIndexedWitness _obs2;
/// Indexed observer for source 3.
- private readonly CombineLatestIndexedObserver _obs3;
+ private readonly CombineLatestIndexedWitness _obs3;
/// Indexed observer for source 4.
- private readonly CombineLatestIndexedObserver _obs4;
+ private readonly CombineLatestIndexedWitness _obs4;
/// Indexed observer for source 5.
- private readonly CombineLatestIndexedObserver _obs5;
+ private readonly CombineLatestIndexedWitness _obs5;
/// Indexed observer for source 6.
- private readonly CombineLatestIndexedObserver _obs6;
+ private readonly CombineLatestIndexedWitness _obs6;
/// Indexed observer for source 7.
- private readonly CombineLatestIndexedObserver _obs7;
+ private readonly CombineLatestIndexedWitness _obs7;
/// Indexed observer for source 8.
- private readonly CombineLatestIndexedObserver _obs8;
+ private readonly CombineLatestIndexedWitness _obs8;
/// Indexed observer for source 9.
- private readonly CombineLatestIndexedObserver _obs9;
+ private readonly CombineLatestIndexedWitness _obs9;
/// Latest value from source 1.
private Optional _val1 = Optional.Empty;
@@ -235,12 +235,12 @@ internal readonly record struct Values(
T9 V9);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer.
/// The bundled source observables.
/// The selector that projects the latest values.
- public CombineLatestSubscription(
+ public CombineLatestCoordinator(
IObserverAsync observer,
Sources sources,
Func selector)
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CombineLatestEnumerable.cs b/src/ReactiveUI.Primitives.Async/Operators/CombineLatestEnumerable.cs
index a8251f7..09bbe3f 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CombineLatestEnumerable.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CombineLatestEnumerable.cs
@@ -91,19 +91,19 @@ protected override async ValueTask SubscribeAsyncCore(
return DisposableAsync.Empty;
}
- var subscription = new Subscription(_sources, observer, resultSelector);
+ var subscription = new EnumerableCombineLatestCoordinator(_sources, observer, resultSelector);
return await SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
() => subscription.SubscribeSourcesAsync(cancellationToken)).ConfigureAwait(false);
}
///
- /// Per-source observer that forwards to the parent subscription with its own index. Replaces the three
+ /// Per-source witness that forwards to the parent subscription with its own index. Replaces the three
/// captured-index lambdas the previous shape allocated per source.
///
- /// The parent subscription.
+ /// The parent coordinator.
/// The source index.
- internal sealed class IndexedObserver(Subscription parent, int index) : IObserverAsync
+ internal sealed class IndexedWitness(EnumerableCombineLatestCoordinator parent, int index) : IObserverAsync
{
///
public ValueTask OnNextAsync(TSource value, CancellationToken cancellationToken) =>
@@ -127,13 +127,13 @@ public ValueTask OnCompletedAsync(Result result) =>
/// The source sequences.
/// The observer.
/// The result selector.
- internal sealed class Subscription(
+ internal sealed class EnumerableCombineLatestCoordinator(
IObservableAsync[] sources,
IObserverAsync observer,
Func, TResult> resultSelector) : IAsyncDisposable
{
/// Synchronization gate.
- private readonly AsyncGate _gate = new();
+ private readonly AsyncSerialGate _gate = new();
/// Cancellation source for disposal.
private readonly CancellationTokenSource _disposeCts = new();
@@ -191,13 +191,13 @@ public async ValueTask SubscribeSourcesAsync(CancellationToken cancellationToken
}
_subscriptions[index] = await _sources[index]
- .SubscribeAsync(new IndexedObserver(this, index), cancellationToken)
+ .SubscribeAsync(new IndexedWitness(this, index), cancellationToken)
.ConfigureAwait(false);
}
}
///
- public ValueTask DisposeAsync() => CompleteAsync(null);
+ public ValueTask DisposeAsync() => FinishAsync(null);
///
/// Handles OnNext from a source.
@@ -208,9 +208,9 @@ public async ValueTask SubscribeSourcesAsync(CancellationToken cancellationToken
/// A value task representing the operation.
internal async ValueTask OnNextAsync(int index, TSource indexValue, CancellationToken cancellationToken)
{
- using (await _gate.LockAsync(cancellationToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(cancellationToken).ConfigureAwait(false))
{
- if (DisposalHelper.IsDisposed(_disposed))
+ if (DisposalHelper.HasDisposed(_disposed))
{
return;
}
@@ -242,7 +242,7 @@ internal async ValueTask OnNextAsync(int index, TSource indexValue, Cancellation
}
catch (Exception ex)
{
- await CompleteAsync(Result.Failure(ex)).ConfigureAwait(false);
+ await FinishAsync(Result.Failure(ex)).ConfigureAwait(false);
return;
}
@@ -258,9 +258,9 @@ internal async ValueTask OnNextAsync(int index, TSource indexValue, Cancellation
/// A value task representing the operation.
internal async ValueTask OnErrorResumeAsync(Exception error, CancellationToken cancellationToken)
{
- using (await _gate.LockAsync(cancellationToken).ConfigureAwait(false))
+ using (await _gate.EnterAsync(cancellationToken).ConfigureAwait(false))
{
- if (DisposalHelper.IsDisposed(_disposed))
+ if (DisposalHelper.HasDisposed(_disposed))
{
return;
}
@@ -279,7 +279,7 @@ internal ValueTask OnCompletedAsync(int index, Result result)
{
if (result.IsFailure)
{
- return CompleteAsync(result);
+ return FinishAsync(result);
}
bool shouldComplete;
@@ -295,17 +295,17 @@ internal ValueTask OnCompletedAsync(int index, Result result)
shouldComplete = !_values[index].HasValue || _completedCount == _sources.Length;
}
- return shouldComplete ? CompleteAsync(Result.Success) : default;
+ return shouldComplete ? FinishAsync(Result.Success) : default;
}
///
/// Completes the subscription. The gate / dispose CTS are always released in the finally
/// block so a misbehaving downstream's OnCompletedAsync can't leak the SemaphoreSlim inside
- /// AsyncGate or the dispose CTS's wait handles.
+ /// AsyncSerialGate or the dispose CTS's wait handles.
///
/// The result.
/// A value task representing the operation.
- internal async ValueTask CompleteAsync(Result? result)
+ internal async ValueTask FinishAsync(Result? result)
{
if (DisposalHelper.TrySetDisposed(ref _disposed))
{
diff --git a/src/ReactiveUI.Primitives.Async/Operators/ConcatEnumerableSignal{T}.cs b/src/ReactiveUI.Primitives.Async/Operators/ConcatEnumerableSignal{T}.cs
index 10cb913..2cdaa44 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/ConcatEnumerableSignal{T}.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/ConcatEnumerableSignal{T}.cs
@@ -26,7 +26,7 @@ internal sealed class ConcatEnumerableSignal(IEnumerable>
private readonly IEnumerable> _signals = signals;
///
- /// Subscribes the specified observer by creating a that iterates
+ /// Subscribes the specified observer by creating a that iterates
/// through the enumerable of observables sequentially.
///
/// The observer to receive elements from the concatenated sequences.
@@ -36,17 +36,17 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new ConcatEnumerableSubscription(this, observer);
+ var subscription = new ConcatSequenceCoordinator(this, observer);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
- subscription.SubscribeNextAsync);
+ subscription.SubscribeNextSignalAsync);
}
///
/// Manages sequential iteration through the enumerable of observables, subscribing to each
/// inner observable only after the previous one completes.
///
- internal sealed class ConcatEnumerableSubscription : IAsyncDisposable
+ internal sealed class ConcatSequenceCoordinator : IAsyncDisposable
{
///
/// Enumerator that iterates through the collection of observable sequences to concatenate.
@@ -79,11 +79,11 @@ internal sealed class ConcatEnumerableSubscription : IAsyncDisposable
private int _disposed;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The parent observable that provides the enumerable of observables.
/// The downstream observer to forward elements to.
- public ConcatEnumerableSubscription(ConcatEnumerableSignal parent, IObserverAsync observer)
+ public ConcatSequenceCoordinator(ConcatEnumerableSignal parent, IObserverAsync observer)
{
_observer = observer;
_enumerator = parent._signals.GetEnumerator();
@@ -95,7 +95,7 @@ public ConcatEnumerableSubscription(ConcatEnumerableSignal parent, IObserverA
/// or completes if no more observables are available.
///
/// A task representing the asynchronous operation.
- public async ValueTask SubscribeNextAsync()
+ public async ValueTask SubscribeNextSignalAsync()
{
try
{
@@ -103,29 +103,29 @@ public async ValueTask SubscribeNextAsync()
{
var current = _enumerator.Current;
var subscription = await current.SubscribeAsync(
- OnInnerNextAsync,
- OnInnerErrorResumeAsync,
- result => result.IsFailure ? CompleteAsync(result) : SubscribeNextAsync(),
+ RelayInnerValueAsync,
+ RelayInnerErrorAsync,
+ result => result.IsFailure ? FinishAsync(result) : SubscribeNextSignalAsync(),
_disposedCancellationToken).ConfigureAwait(false);
await _innerDisposable.SetDisposableAsync(subscription).ConfigureAwait(false);
}
else
{
- await CompleteAsync(Result.Success).ConfigureAwait(false);
+ await FinishAsync(Result.Success).ConfigureAwait(false);
}
}
catch (Exception e)
{
- await CompleteAsync(Result.Failure(e)).ConfigureAwait(false);
+ await FinishAsync(Result.Failure(e)).ConfigureAwait(false);
}
}
///
- public ValueTask DisposeAsync() => CompleteAsync(null);
+ public ValueTask DisposeAsync() => FinishAsync(null);
///
- /// Handles a second call to when already disposed,
+ /// Handles a second call to when already disposed,
/// routing any failure exception to the unhandled exception handler.
///
/// The completion result from the second call.
@@ -136,7 +136,7 @@ internal static void HandleAlreadyDisposed(Result? result)
return;
}
- UnhandledExceptionHandler.OnUnhandledException(exception);
+ UnhandledExceptionHandler.ReportUnhandledException(exception);
}
///
@@ -145,9 +145,9 @@ internal static void HandleAlreadyDisposed(Result? result)
/// The error to forward.
/// A token to cancel the operation.
/// A task representing the asynchronous operation.
- internal ValueTask OnInnerErrorResumeAsync(Exception exception, CancellationToken cancellationToken)
+ internal ValueTask RelayInnerErrorAsync(Exception exception, CancellationToken cancellationToken)
{
- // The inner subscription is rooted in _disposedCancellationToken (see SubscribeNextAsync),
+ // The inner subscription is rooted in _disposedCancellationToken (see SubscribeNextSignalAsync),
// so its disposal already cascades into the inner observer's own cancellation. Forwarding
// _disposedCancellationToken directly preserves the cancellation semantics that a linked
// CTS would have provided, without the per-emission Linked2CancellationTokenSource alloc
@@ -160,9 +160,9 @@ internal ValueTask OnInnerErrorResumeAsync(Exception exception, CancellationToke
/// Forwards an element from the current inner sequence to the downstream observer.
///
/// The element to forward.
- /// A token to cancel the operation. Ignored — see .
+ /// A token to cancel the operation. Ignored — see .
/// A task representing the asynchronous operation.
- internal ValueTask OnInnerNextAsync(T value, CancellationToken cancellationToken)
+ internal ValueTask RelayInnerValueAsync(T value, CancellationToken cancellationToken)
{
_ = cancellationToken;
return _observer.OnNextAsync(value, _disposedCancellationToken);
@@ -174,7 +174,7 @@ internal ValueTask OnInnerNextAsync(T value, CancellationToken cancellationToken
///
/// The completion result to forward, or if disposing without signaling completion.
/// A task representing the asynchronous operation.
- internal async ValueTask CompleteAsync(Result? result)
+ internal async ValueTask FinishAsync(Result? result)
{
if (DisposalHelper.TrySetDisposed(ref _disposed))
{
diff --git a/src/ReactiveUI.Primitives.Async/Operators/ConcatSignalSourcesSignal{T}.cs b/src/ReactiveUI.Primitives.Async/Operators/ConcatSignalSourcesSignal{T}.cs
index f491df7..2688a04 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/ConcatSignalSourcesSignal{T}.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/ConcatSignalSourcesSignal{T}.cs
@@ -17,7 +17,7 @@ namespace ReactiveUI.Primitives.Async;
internal sealed class ConcatSignalSourcesSignal(IObservableAsync> source) : SignalAsync
{
///
- /// Subscribes the specified observer by creating a that manages
+ /// Subscribes the specified observer by creating a that manages
/// sequential subscription to inner observables.
///
/// The observer to receive elements from the concatenated sequences.
@@ -27,7 +27,7 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var subscription = new ConcatSubscription(observer);
+ var subscription = new ConcatCoordinator(observer);
return SubscriptionHelper.SubscribeAndDisposeOnFailureAsync(
subscription,
() => subscription.SubscribeAsync(source, cancellationToken));
@@ -37,7 +37,7 @@ protected override ValueTask SubscribeAsyncCore(
/// Manages the lifetime of the outer subscription and buffers inner observables,
/// subscribing to each one sequentially as the previous completes.
///
- internal sealed class ConcatSubscription : IAsyncDisposable
+ internal sealed class ConcatCoordinator : IAsyncDisposable
{
///
/// Concurrent queue that buffers inner observables waiting to be subscribed to.
@@ -72,7 +72,7 @@ internal sealed class ConcatSubscription : IAsyncDisposable
///
/// Async gate that serializes observer callbacks to ensure thread-safe emission.
///
- private readonly AsyncGate _observerOnSomethingGate = new();
+ private readonly AsyncSerialGate _observerOnSomethingGate = new();
///
/// Indicates whether the outer observable sequence has completed.
@@ -85,10 +85,10 @@ internal sealed class ConcatSubscription : IAsyncDisposable
private int _disposed;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The downstream observer to forward elements to.
- public ConcatSubscription(IObserverAsync observer)
+ public ConcatCoordinator(IObserverAsync observer)
{
_observer = observer;
_disposedCancellationToken = _disposeCts.Token;
@@ -104,7 +104,7 @@ public async ValueTask SubscribeAsync(
IObservableAsync> source,
CancellationToken subscriptionToken)
{
- var outerSubscription = await source.SubscribeAsync(new ConcatOuterObserver(this), subscriptionToken).ConfigureAwait(false);
+ var outerSubscription = await source.SubscribeAsync(new ConcatOuterWitness(this), subscriptionToken).ConfigureAwait(false);
await _outerDisposable.SetDisposableAsync(outerSubscription).ConfigureAwait(false);
}
@@ -114,7 +114,7 @@ public async ValueTask SubscribeAsync(
///
/// The inner observable to enqueue.
/// A task representing the asynchronous operation.
- public ValueTask OnNextOuterAsync(IObservableAsync inner)
+ public ValueTask AcceptOuterValueAsync(IObservableAsync inner)
{
var shouldSubscribe = false;
lock (_buffer)
@@ -131,7 +131,7 @@ public ValueTask OnNextOuterAsync(IObservableAsync inner)
return default;
}
- return SubscribeToInnerLoop(inner);
+ return SubscribeCurrentInnerAsync(inner);
}
///
@@ -140,7 +140,7 @@ public ValueTask OnNextOuterAsync(IObservableAsync inner)
///
/// The completion result from the outer sequence.
/// A task representing the asynchronous completion operation.
- public ValueTask OnCompletedOuterAsync(Result result)
+ public ValueTask AcceptOuterCompletionAsync(Result result)
{
var shouldComplete = false;
Result? completeResult = null;
@@ -154,7 +154,7 @@ public ValueTask OnCompletedOuterAsync(Result result)
}
}
- return shouldComplete ? CompleteAsync(completeResult) : default;
+ return shouldComplete ? FinishAsync(completeResult) : default;
}
///
@@ -163,11 +163,11 @@ public ValueTask OnCompletedOuterAsync(Result result)
///
/// The completion result from the inner sequence.
/// A task representing the asynchronous completion operation.
- public ValueTask OnCompletedInnerAsync(Result result)
+ public ValueTask AcceptInnerCompletionAsync(Result result)
{
if (result.IsFailure)
{
- return CompleteAsync(result);
+ return FinishAsync(result);
}
IObservableAsync? nextInner;
@@ -181,17 +181,17 @@ public ValueTask OnCompletedInnerAsync(Result result)
if (nextInner is null)
{
- return outerCompleted ? CompleteAsync(Result.Success) : default;
+ return outerCompleted ? FinishAsync(Result.Success) : default;
}
- return SubscribeToInnerLoop(nextInner);
+ return SubscribeCurrentInnerAsync(nextInner);
}
///
- public ValueTask DisposeAsync() => CompleteAsync(null);
+ public ValueTask DisposeAsync() => FinishAsync(null);
///
- /// Handles a second call to when already disposed,
+ /// Handles a second call to when already disposed,
/// routing any failure exception to the unhandled exception handler.
///
/// The completion result from the second call.
@@ -202,7 +202,7 @@ internal static void HandleAlreadyDisposed(Result? result)
return;
}
- UnhandledExceptionHandler.OnUnhandledException(exception);
+ UnhandledExceptionHandler.ReportUnhandledException(exception);
}
///
@@ -210,17 +210,17 @@ internal static void HandleAlreadyDisposed(Result? result)
///
/// The inner observable to subscribe to.
/// A task representing the asynchronous operation.
- internal async ValueTask SubscribeToInnerLoop(IObservableAsync currentInner)
+ internal async ValueTask SubscribeCurrentInnerAsync(IObservableAsync currentInner)
{
try
{
var innerSubscription =
- await currentInner.SubscribeAsync(new ConcatInnerObserver(this), _disposedCancellationToken).ConfigureAwait(false);
+ await currentInner.SubscribeAsync(new ConcatInnerWitness(this), _disposedCancellationToken).ConfigureAwait(false);
await _innerSubscription.SetDisposableAsync(innerSubscription).ConfigureAwait(false);
}
catch (Exception e)
{
- await CompleteAsync(Result.Failure(e)).ConfigureAwait(false);
+ await FinishAsync(Result.Failure(e)).ConfigureAwait(false);
}
}
@@ -230,7 +230,7 @@ internal async ValueTask SubscribeToInnerLoop(IObservableAsync currentInner)
///
/// The completion result to forward, or if disposing without signaling completion.
/// A task representing the asynchronous operation.
- internal async ValueTask CompleteAsync(Result? result)
+ internal async ValueTask FinishAsync(Result? result)
{
if (DisposalHelper.TrySetDisposed(ref _disposed))
{
@@ -251,10 +251,10 @@ internal async ValueTask CompleteAsync(Result? result)
}
///
- /// Observer for the outer observable sequence that delegates to the parent .
+ /// A witness for the outer observable sequence that delegates to the parent .
///
/// The parent concat subscription.
- internal sealed class ConcatOuterObserver(ConcatSubscription subscription) : ObserverAsync>
+ internal sealed class ConcatOuterWitness(ConcatCoordinator subscription) : ObserverAsync>
{
///
/// Forwards a new inner observable to the parent subscription for buffering and sequential subscription.
@@ -263,7 +263,7 @@ internal sealed class ConcatOuterObserver(ConcatSubscription subscription) : Obs
/// A token to cancel the operation.
/// A task representing the asynchronous operation.
protected override ValueTask OnNextAsyncCore(IObservableAsync value, CancellationToken cancellationToken)
- => subscription.OnNextOuterAsync(value);
+ => subscription.AcceptOuterValueAsync(value);
///
/// Forwards a non-fatal error from the outer sequence to the downstream observer.
@@ -281,7 +281,7 @@ protected override async ValueTask OnErrorResumeAsyncCore(
// provided, without the per-emission Linked2CancellationTokenSource alloc.
_ = cancellationToken;
var token = subscription._disposedCancellationToken;
- using (await subscription._observerOnSomethingGate.LockAsync(token).ConfigureAwait(false))
+ using (await subscription._observerOnSomethingGate.EnterAsync(token).ConfigureAwait(false))
{
await subscription._observer.OnErrorResumeAsync(error, token).ConfigureAwait(false);
}
@@ -293,14 +293,14 @@ protected override async ValueTask OnErrorResumeAsyncCore(
/// The completion result.
/// A task representing the asynchronous operation.
protected override ValueTask OnCompletedAsyncCore(Result result)
- => subscription.OnCompletedOuterAsync(result);
+ => subscription.AcceptOuterCompletionAsync(result);
}
///
- /// Observer for the currently active inner observable sequence that delegates to the parent .
+ /// A witness for the currently active inner observable sequence that delegates to the parent .
///
/// The parent concat subscription.
- internal sealed class ConcatInnerObserver(ConcatSubscription subscription) : ObserverAsync
+ internal sealed class ConcatInnerWitness(ConcatCoordinator subscription) : ObserverAsync
{
///
/// Forwards an element from the inner sequence to the downstream observer.
@@ -312,7 +312,7 @@ protected override async ValueTask OnNextAsyncCore(T value, CancellationToken ca
{
_ = cancellationToken;
var token = subscription._disposedCancellationToken;
- using (await subscription._observerOnSomethingGate.LockAsync(token).ConfigureAwait(false))
+ using (await subscription._observerOnSomethingGate.EnterAsync(token).ConfigureAwait(false))
{
await subscription._observer.OnNextAsync(value, token).ConfigureAwait(false);
}
@@ -330,7 +330,7 @@ protected override async ValueTask OnErrorResumeAsyncCore(
{
_ = cancellationToken;
var token = subscription._disposedCancellationToken;
- using (await subscription._observerOnSomethingGate.LockAsync(token).ConfigureAwait(false))
+ using (await subscription._observerOnSomethingGate.EnterAsync(token).ConfigureAwait(false))
{
await subscription._observer.OnErrorResumeAsync(error, token).ConfigureAwait(false);
}
@@ -342,7 +342,7 @@ protected override async ValueTask OnErrorResumeAsyncCore(
/// The completion result.
/// A task representing the asynchronous operation.
protected override ValueTask OnCompletedAsyncCore(Result result)
- => subscription.OnCompletedInnerAsync(result);
+ => subscription.AcceptInnerCompletionAsync(result);
}
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/ContainsAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/ContainsAsync.cs
index 02710f1..c16c234 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/ContainsAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/ContainsAsync.cs
@@ -46,9 +46,9 @@ public static async ValueTask ContainsAsync(
{
cancellationToken.ThrowIfCancellationRequested();
var cmp = comparer ?? EqualityComparer.Default;
- var observer = new ContainsAsyncObserver(value, cmp, cancellationToken);
+ var observer = new ContainsTaskWitness(value, cmp, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -75,32 +75,32 @@ public static ValueTask ContainsAsync(this IObservableAsync @this, T
=> @this.ContainsAsync(value, null, cancellationToken);
///
- /// Observer that determines whether a sequence contains a specified value.
+ /// A witness that determines whether a sequence contains a specified value.
///
/// The type of elements in the source sequence.
/// The value to search for.
/// The equality comparer to use for comparison.
/// A cancellation token for the operation.
- internal sealed class ContainsAsyncObserver(
+ internal sealed class ContainsTaskWitness(
T value,
IEqualityComparer comparer,
- CancellationToken cancellationToken) : TaskObserverAsyncBase(cancellationToken)
+ CancellationToken cancellationToken) : TaskResultWitnessAsyncBase(cancellationToken)
{
///
protected override async ValueTask OnNextAsyncCore(T value1, CancellationToken cancellationToken)
{
if (comparer.Equals(value, value1))
{
- await TrySetCompleted(true).ConfigureAwait(false);
+ await SetResultAndDisposeAsync(true).ConfigureAwait(false);
}
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken)
- => TrySetException(error);
+ => SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result)
- => result.IsSuccess ? TrySetCompleted(false) : TrySetException(result.Exception);
+ => result.IsSuccess ? SetResultAndDisposeAsync(false) : SetExceptionAndDisposeAsync(result.Exception);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/ObserveOnAsyncSignal.cs b/src/ReactiveUI.Primitives.Async/Operators/ContextSwitchSignalAsync.cs
similarity index 83%
rename from src/ReactiveUI.Primitives.Async/Operators/ObserveOnAsyncSignal.cs
rename to src/ReactiveUI.Primitives.Async/Operators/ContextSwitchSignalAsync.cs
index fbd76fb..f4de676 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/ObserveOnAsyncSignal.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/ContextSwitchSignalAsync.cs
@@ -11,7 +11,7 @@ namespace ReactiveUI.Primitives.Async;
/// The source observable whose notifications will be context-switched.
/// The async context to switch notifications onto.
/// Whether to force yielding even if already on the target context.
-internal sealed class ObserveOnAsyncSignal(
+internal sealed class ContextSwitchSignalAsync(
IObservableAsync source,
AsyncContext asyncContext,
bool forceYielding) : SignalAsync
@@ -21,8 +21,8 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var observeOnObserver = new ObserveOnObserver(observer, asyncContext, forceYielding);
- return source.SubscribeAsync(observeOnObserver, cancellationToken);
+ var contextSwitchObserver = new ContextSwitchWitness(observer, asyncContext, forceYielding);
+ return source.SubscribeAsync(contextSwitchObserver, cancellationToken);
}
///
@@ -31,7 +31,7 @@ protected override ValueTask SubscribeAsyncCore(
/// The downstream observer to forward notifications to.
/// The async context to switch onto.
/// Whether to force yielding even if already on the target context.
- internal sealed class ObserveOnObserver(IObserverAsync observer, AsyncContext asyncContext, bool forceYielding)
+ internal sealed class ContextSwitchWitness(IObserverAsync observer, AsyncContext asyncContext, bool forceYielding)
: ObserverAsync
{
/// Slow path: switch to the target context then forward the value.
@@ -40,7 +40,7 @@ internal sealed class ObserveOnObserver(IObserverAsync observer, AsyncContext
/// The value to forward.
/// The cancellation token.
/// A task that completes after the context switch and downstream forward.
- internal async ValueTask SwitchThenForwardAsync(T value, CancellationToken cancellationToken)
+ internal async ValueTask ForwardAfterContextSwitchAsync(T value, CancellationToken cancellationToken)
{
await asyncContext.SwitchContextAsync(forceYielding, cancellationToken);
await observer.OnNextAsync(value, cancellationToken).ConfigureAwait(false);
@@ -51,7 +51,7 @@ internal async ValueTask SwitchThenForwardAsync(T value, CancellationToken cance
/// The error to forward.
/// The cancellation token.
/// A task that completes after the context switch and downstream forward.
- internal async ValueTask SwitchThenErrorAsync(Exception error, CancellationToken cancellationToken)
+ internal async ValueTask ForwardErrorAfterContextSwitchAsync(Exception error, CancellationToken cancellationToken)
{
await asyncContext.SwitchContextAsync(forceYielding, cancellationToken);
await observer.OnErrorResumeAsync(error, cancellationToken).ConfigureAwait(false);
@@ -61,7 +61,7 @@ internal async ValueTask SwitchThenErrorAsync(Exception error, CancellationToken
/// Exposed as for direct unit testing.
/// The completion result.
/// A task that completes after the context switch and downstream forward.
- internal async ValueTask SwitchThenCompletedAsync(Result result)
+ internal async ValueTask ForwardCompletionAfterContextSwitchAsync(Result result)
{
await asyncContext.SwitchContextAsync(forceYielding, CancellationToken.None);
await observer.OnCompletedAsync(result).ConfigureAwait(false);
@@ -77,7 +77,7 @@ protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancella
return observer.OnNextAsync(value, cancellationToken);
}
- return SwitchThenForwardAsync(value, cancellationToken);
+ return ForwardAfterContextSwitchAsync(value, cancellationToken);
}
///
@@ -88,7 +88,7 @@ protected override ValueTask OnErrorResumeAsyncCore(Exception error, Cancellatio
return observer.OnErrorResumeAsync(error, cancellationToken);
}
- return SwitchThenErrorAsync(error, cancellationToken);
+ return ForwardErrorAfterContextSwitchAsync(error, cancellationToken);
}
///
@@ -99,7 +99,7 @@ protected override ValueTask OnCompletedAsyncCore(Result result)
return observer.OnCompletedAsync(result);
}
- return SwitchThenCompletedAsync(result);
+ return ForwardCompletionAfterContextSwitchAsync(result);
}
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/CountAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/CountAsync.cs
index 988ca71..dc4fc68 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/CountAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/CountAsync.cs
@@ -37,9 +37,9 @@ public static ValueTask CountAsync(this IObservableAsync @this, Func<
public static async ValueTask CountAsync(this IObservableAsync @this, Func? predicate, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new CountAsyncObserver(predicate, cancellationToken);
+ var observer = new CountTaskWitness(predicate, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -64,13 +64,13 @@ public static ValueTask CountAsync(this IObservableAsync @this, Cance
=> @this.CountAsync(null, cancellationToken);
///
- /// Observer that counts elements in a sequence, optionally filtered by a predicate.
+ /// A witness that counts elements in a sequence, optionally filtered by a predicate.
///
/// The type of elements in the source sequence.
/// An optional predicate to filter elements. If null, all elements are counted.
/// A cancellation token for the operation.
- internal sealed class CountAsyncObserver(Func? predicate, CancellationToken cancellationToken)
- : TaskObserverAsyncBase(cancellationToken)
+ internal sealed class CountTaskWitness(Func? predicate, CancellationToken cancellationToken)
+ : TaskResultWitnessAsyncBase(cancellationToken)
{
///
/// The running count of elements that satisfy the predicate.
@@ -92,10 +92,10 @@ protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancella
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- !result.IsSuccess ? TrySetException(result.Exception) : TrySetCompleted(_count);
+ !result.IsSuccess ? SetExceptionAndDisposeAsync(result.Exception) : SetResultAndDisposeAsync(_count);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/Delay.cs b/src/ReactiveUI.Primitives.Async/Operators/Delay.cs
index bcdd77c..1cffac4 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/Delay.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/Delay.cs
@@ -66,14 +66,14 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var delayObserver = new DelayObserver(observer, delayInterval, timeProvider, cancellationToken);
+ var delayObserver = new DelayWitness(observer, delayInterval, timeProvider, cancellationToken);
return source.SubscribeAsync(delayObserver, cancellationToken);
}
///
- /// An observer that delays each element by waiting before forwarding to the downstream observer.
+ /// A witness that delays each element by waiting before forwarding to the downstream witness.
///
- internal sealed class DelayObserver(
+ internal sealed class DelayWitness(
IObserverAsync observer,
TimeSpan delayInterval,
TimeProvider timeProvider,
diff --git a/src/ReactiveUI.Primitives.Async/Operators/Distinct.cs b/src/ReactiveUI.Primitives.Async/Operators/Distinct.cs
index 28913d4..0deec7f 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/Distinct.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/Distinct.cs
@@ -100,7 +100,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new DistinctObserver(observer, comparer, cancellationToken);
+ var sink = new DistinctWitness(observer, comparer, cancellationToken);
if (observer is ObserverAsync downstreamBase)
{
@@ -108,15 +108,15 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that tracks seen values in a .
- /// The downstream observer.
+ /// Per-subscription witness that tracks seen values in a .
+ /// The downstream witness.
/// The equality comparer.
/// The subscribe-time cancellation token.
- internal sealed class DistinctObserver(
+ internal sealed class DistinctWitness(
IObserverAsync downstream,
IEqualityComparer comparer,
CancellationToken subscribeToken) : ObserverAsync(subscribeToken)
@@ -154,7 +154,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new DistinctByObserver(observer, keySelector, comparer, cancellationToken);
+ var sink = new DistinctByWitness(observer, keySelector, comparer, cancellationToken);
if (observer is ObserverAsync downstreamBase)
{
@@ -162,16 +162,16 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that tracks seen keys.
- /// The downstream observer.
+ /// Per-subscription witness that tracks seen keys.
+ /// The downstream witness.
/// The key selector.
/// The key equality comparer.
/// The subscribe-time cancellation token.
- internal sealed class DistinctByObserver(
+ internal sealed class DistinctByWitness(
IObserverAsync downstream,
Func keySelector,
IEqualityComparer comparer,
diff --git a/src/ReactiveUI.Primitives.Async/Operators/DistinctUntilChanged.cs b/src/ReactiveUI.Primitives.Async/Operators/DistinctUntilChanged.cs
index 59d045e..25c83ae 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/DistinctUntilChanged.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/DistinctUntilChanged.cs
@@ -106,7 +106,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new DistinctUntilChangedObserver(observer, comparer, cancellationToken);
+ var sink = new DistinctUntilChangedWitness(observer, comparer, cancellationToken);
if (observer is ObserverAsync downstreamBase)
{
@@ -114,15 +114,15 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that drops values equal to the most-recently-forwarded one.
- /// The downstream observer.
+ /// Per-subscription witness that drops values equal to the most-recently-forwarded one.
+ /// The downstream witness.
/// The equality comparer.
/// The subscribe-time cancellation token.
- internal sealed class DistinctUntilChangedObserver(
+ internal sealed class DistinctUntilChangedWitness(
IObserverAsync downstream,
IEqualityComparer comparer,
CancellationToken subscribeToken) : ObserverAsync(subscribeToken)
@@ -175,7 +175,7 @@ protected override async ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var sink = new DistinctUntilChangedByObserver(observer, keySelector, comparer, cancellationToken);
+ var sink = new DistinctUntilChangedByWitness(observer, keySelector, comparer, cancellationToken);
if (observer is ObserverAsync downstreamBase)
{
@@ -183,16 +183,16 @@ protected override async ValueTask SubscribeAsyncCore(
}
var subscription = await source.SubscribeAsync(sink, cancellationToken).ConfigureAwait(false);
- await sink.SetSourceSubscriptionAsync(subscription).ConfigureAwait(false);
+ await sink.AssignSourceSubscriptionAsync(subscription).ConfigureAwait(false);
return sink;
}
- /// Per-subscription observer that compares extracted keys against the most-recently-forwarded one.
- /// The downstream observer.
+ /// Per-subscription witness that compares extracted keys against the most-recently-forwarded one.
+ /// The downstream witness.
/// The key selector.
/// The key equality comparer.
/// The subscribe-time cancellation token.
- internal sealed class DistinctUntilChangedByObserver(
+ internal sealed class DistinctUntilChangedByWitness(
IObserverAsync downstream,
Func keySelector,
IEqualityComparer comparer,
diff --git a/src/ReactiveUI.Primitives.Async/Operators/Do.cs b/src/ReactiveUI.Primitives.Async/Operators/Do.cs
index bd1dd52..fab81ee 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/Do.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/Do.cs
@@ -96,14 +96,14 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var doObserver = new DoAsyncObserver(observer, onNext, onErrorResume, onCompleted);
+ var doObserver = new AsyncSideEffectWitness(observer, onNext, onErrorResume, onCompleted);
return source.SubscribeAsync(doObserver, cancellationToken);
}
///
- /// An observer that invokes asynchronous side-effect callbacks before forwarding notifications.
+ /// A witness that invokes asynchronous side-effect callbacks before forwarding notifications.
///
- internal sealed class DoAsyncObserver(
+ internal sealed class AsyncSideEffectWitness(
IObserverAsync observer,
Func? onNext,
Func? onErrorResume,
@@ -161,14 +161,14 @@ protected override ValueTask SubscribeAsyncCore(
IObserverAsync observer,
CancellationToken cancellationToken)
{
- var doObserver = new DoSyncObserver(observer, onNext, onErrorResume, onCompleted);
+ var doObserver = new SyncSideEffectWitness(observer, onNext, onErrorResume, onCompleted);
return source.SubscribeAsync(doObserver, cancellationToken);
}
///
/// An observer that invokes synchronous side-effect callbacks before forwarding notifications.
///
- internal sealed class DoSyncObserver(
+ internal sealed class SyncSideEffectWitness(
IObserverAsync observer,
Action? onNext,
Action? onErrorResume,
diff --git a/src/ReactiveUI.Primitives.Async/Operators/FirstAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/FirstAsync.cs
index 4196652..2cd3198 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/FirstAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/FirstAsync.cs
@@ -39,9 +39,9 @@ public static ValueTask FirstAsync(this IObservableAsync @this, Func FirstAsync(this IObservableAsync @this, Func predicate, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new FirstAsyncObserver(predicate, cancellationToken);
+ var observer = new FirstTaskWitness(predicate, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -69,32 +69,32 @@ public static ValueTask FirstAsync(this IObservableAsync @this)
public static async ValueTask FirstAsync(this IObservableAsync @this, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new FirstAsyncObserver(null, cancellationToken);
+ var observer = new FirstTaskWitness(null, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
- /// Observer that captures the first element matching an optional predicate.
+ /// A witness that captures the first element matching an optional predicate.
///
/// The type of elements in the source sequence.
/// An optional predicate to filter elements.
/// A cancellation token for the operation.
- internal sealed class FirstAsyncObserver(Func? predicate, CancellationToken cancellationToken)
- : TaskObserverAsyncBase(cancellationToken)
+ internal sealed class FirstTaskWitness(Func? predicate, CancellationToken cancellationToken)
+ : TaskResultWitnessAsyncBase(cancellationToken)
{
///
protected override async ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken)
{
if (predicate is null || predicate(value))
{
- await TrySetCompleted(value).ConfigureAwait(false);
+ await SetResultAndDisposeAsync(value).ConfigureAwait(false);
}
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result)
@@ -112,7 +112,7 @@ protected override ValueTask OnCompletedAsyncCore(Result result)
exception = result.Exception;
}
- return TrySetException(exception);
+ return SetExceptionAndDisposeAsync(exception);
}
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/FirstOrDefaultAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/FirstOrDefaultAsync.cs
index f28149e..82def38 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/FirstOrDefaultAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/FirstOrDefaultAsync.cs
@@ -51,9 +51,9 @@ public static partial class SignalAsync
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new FirstOrDefaultObserver(predicate, defaultValue, cancellationToken);
+ var observer = new FirstOrDefaultTaskWitness(predicate, defaultValue, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -104,38 +104,38 @@ public static partial class SignalAsync
public static async ValueTask FirstOrDefaultAsync(this IObservableAsync @this, T? defaultValue, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- var observer = new FirstOrDefaultObserver(null, defaultValue, cancellationToken);
+ var observer = new FirstOrDefaultTaskWitness(null, defaultValue, cancellationToken);
await using var subscription = await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- return await observer.WaitValueAsync().ConfigureAwait(false);
+ return await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
- /// Observer that captures the first element matching an optional predicate, or returns a default value.
+ /// A witness that captures the first element matching an optional predicate, or returns a default value.
///
/// The type of elements in the source sequence.
/// An optional predicate to filter elements.
/// The default value to return if no element matches.
/// A cancellation token for the operation.
- internal sealed class FirstOrDefaultObserver(
+ internal sealed class FirstOrDefaultTaskWitness(
Func? predicate,
T? defaultValue,
- CancellationToken cancellationToken) : TaskObserverAsyncBase(cancellationToken)
+ CancellationToken cancellationToken) : TaskResultWitnessAsyncBase(cancellationToken)
{
///
protected override async ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken)
{
if (predicate is null || predicate(value))
{
- await TrySetCompleted(value).ConfigureAwait(false);
+ await SetResultAndDisposeAsync(value).ConfigureAwait(false);
}
}
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- result.IsSuccess ? TrySetCompleted(defaultValue!) : TrySetException(result.Exception);
+ result.IsSuccess ? SetResultAndDisposeAsync(defaultValue!) : SetExceptionAndDisposeAsync(result.Exception);
}
}
diff --git a/src/ReactiveUI.Primitives.Async/Operators/ForEachAsync.cs b/src/ReactiveUI.Primitives.Async/Operators/ForEachAsync.cs
index 61f4cd3..ff47722 100644
--- a/src/ReactiveUI.Primitives.Async/Operators/ForEachAsync.cs
+++ b/src/ReactiveUI.Primitives.Async/Operators/ForEachAsync.cs
@@ -57,9 +57,9 @@ public static async ValueTask ForEachAsync(
}
cancellationToken.ThrowIfCancellationRequested();
- var observer = new ForEachObserver(onNextAsync, cancellationToken);
+ var observer = new ForEachAsyncTaskWitness(onNextAsync, cancellationToken);
await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- await observer.WaitValueAsync().ConfigureAwait(false);
+ await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
@@ -89,18 +89,18 @@ public static async ValueTask ForEachAsync(this IObservableAsync @this, Ac
ArgumentExceptionHelper.ThrowIfNull(onNext);
cancellationToken.ThrowIfCancellationRequested();
- var observer = new ForEachObserverSync(onNext, cancellationToken);
+ var observer = new ForEachSyncTaskWitness(onNext, cancellationToken);
await @this.SubscribeAsync(observer, cancellationToken).ConfigureAwait(false);
- await observer.WaitValueAsync().ConfigureAwait(false);
+ await observer.AwaitResultAsync().ConfigureAwait(false);
}
///
- /// An observer that invokes an asynchronous callback for each element and signals completion via a task.
+ /// A witness that invokes an asynchronous callback for each element and signals completion via a task.
///
/// The type of elements in the sequence.
- internal sealed class ForEachObserver(
+ internal sealed class ForEachAsyncTaskWitness(
Func onNextAsync,
- CancellationToken cancellationToken) : TaskObserverAsyncBase(cancellationToken)
+ CancellationToken cancellationToken) : TaskResultWitnessAsyncBase(cancellationToken)
{
///
protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancellationToken) =>
@@ -108,19 +108,19 @@ protected override ValueTask OnNextAsyncCore(T value, CancellationToken cancella
///
protected override ValueTask OnErrorResumeAsyncCore(Exception error, CancellationToken cancellationToken) =>
- TrySetException(error);
+ SetExceptionAndDisposeAsync(error);
///
protected override ValueTask OnCompletedAsyncCore(Result result) =>
- result.IsSuccess ? TrySetCompleted(true) : TrySetException(result.Exception);
+ result.IsSuccess ? SetResultAndDisposeAsync(true) : SetExceptionAndDisposeAsync(result.Exception);
}
///
- /// An observer that invokes a synchronous callback for each element and signals completion via a task.
+ /// A witness that invokes a synchronous callback for each element and signals completion via a task.
///
/// The type of elements in the sequence.
- internal sealed class ForEachObserverSync(Action