Table of Contents

Class ConcurrentEventSource<TEvent, TSource>

Namespace
LfrlAnvil.Reactive.Internal
Assembly
LfrlAnvil.Reactive.Core.dll

Represents a concurrent version of a generic disposable event source that can be listened to.

public class ConcurrentEventSource<TEvent, TSource> : IEventSource<TEvent>, IEventStream<TEvent>, IEventSource, IEventStream, IDisposable where TSource : EventSource<TEvent>

Type Parameters

TEvent

Event type.

TSource

Underlying event source type.

Inheritance
ConcurrentEventSource<TEvent, TSource>
Implements
IEventSource<TEvent>
IEventStream<TEvent>
Derived
Inherited Members
Extension Methods

Constructors

ConcurrentEventSource(TSource)

protected ConcurrentEventSource(TSource @base)

Parameters

base TSource

Underlying event source.

Properties

Base

Underlying event source.

protected TSource Base { get; }

Property Value

TSource

HasSubscribers

Specifies whether or not this event source has any event subscribers.

public bool HasSubscribers { get; }

Property Value

bool

IsDisposed

Specifies whether or not this event stream has been disposed.

public bool IsDisposed { get; }

Property Value

bool

Subscribers

Collection of currently attached event subscribers to this event source.

public IReadOnlyCollection<IEventSubscriber> Subscribers { get; }

Property Value

IReadOnlyCollection<IEventSubscriber>

Sync

Object used for thread synchronization.

protected object Sync { get; }

Property Value

object

Methods

Decorate<TNextEvent>(IEventListenerDecorator<TEvent, TNextEvent>)

Creates a new decorated IEventStream<TEvent> instance.

[Pure]
public IEventStream<TNextEvent> Decorate<TNextEvent>(IEventListenerDecorator<TEvent, TNextEvent> decorator)

Parameters

decorator IEventListenerDecorator<TEvent, TNextEvent>

Event listener decorator.

Returns

IEventStream<TNextEvent>

Decorated IEventStream<TEvent> instance.

Type Parameters

TNextEvent

Next event type.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

Listen(IEventListener<TEvent>)

Attaches the provided listener to this event stream.

public IEventSubscriber Listen(IEventListener<TEvent> listener)

Parameters

listener IEventListener<TEvent>

Event listener to attach.

Returns

IEventSubscriber

New IEventSubscriber instance that can be used to detach the listener.