/// <summary> /// Initializes a new instance of the <see cref="PipelineElement"/> class. /// </summary> /// <param name="name">The name of the instance.</param> /// <param name="stateObject">The state object wrapped by this node.</param> public PipelineElement(string name, object stateObject) { this.name = name; this.stateObject = stateObject; this.IsSource = stateObject is ISourceComponent; this.syncContext = Locks.GetOrAdd(stateObject, state => new SynchronizationLock(state)); }
/// <summary> /// Initializes a new instance of the <see cref="Emitter{T}"/> class. /// This constructor is intended to be used by the framework. /// </summary> /// <param name="id">The id of this stream.</param> /// <param name="owner">The owning component</param> /// <param name="syncContext">The synchronization context this emitter operates in</param> /// <param name="pipeline">The pipeline to associate with</param> internal Emitter(int id, object owner, SynchronizationLock syncContext, Pipeline pipeline) { this.id = id; this.owner = owner; this.syncContext = syncContext; this.pipeline = pipeline; }
/// <summary> /// Initializes a new instance of the <see cref="PipelineElement"/> class. /// </summary> /// <param name="name">The name of the instance.</param> /// <param name="stateObject">The state object wrapped by this node.</param> public PipelineElement(string name, object stateObject) { this.name = name; this.stateObject = stateObject; this.IsStartable = this.stateObject is IStartable; this.syncContext = new SynchronizationLock(this.stateObject); }
/// <summary> /// Initializes a new instance of the <see cref="PipelineElement"/> class. /// </summary> /// <param name="name">The name of the instance.</param> /// <param name="stateObject">The state object wrapped by this node.</param> public PipelineElement(string name, object stateObject) { this.name = name; this.stateObject = stateObject; this.isFiniteSource = stateObject is IFiniteSourceComponent; this.IsSource = this.isFiniteSource || this.stateObject is ISourceComponent; this.syncContext = new SynchronizationLock(this.stateObject); }
/// <summary> /// Initializes a new instance of the <see cref="Emitter{T}"/> class. /// This constructor is intended to be used by the framework. /// </summary> /// <param name="id">The id of this stream.</param> /// <param name="name">The name of this stream.</param> /// <param name="owner">The owning component.</param> /// <param name="syncContext">The synchronization context this emitter operates in.</param> /// <param name="pipeline">The pipeline to associate with.</param> /// <param name="messageValidator">An optional message validator.</param> internal Emitter(int id, string name, object owner, SynchronizationLock syncContext, Pipeline pipeline, ValidateMessageHandler messageValidator = null) { this.id = id; this.name = name; this.owner = owner; this.syncContext = syncContext; this.pipeline = pipeline; this.messageValidator = messageValidator; }
internal Receiver(object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.onReceived = PipelineElement.TrackStateObjectOnContext <Message <T> >(onReceived, owner, pipeline); this.owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.cloner = RecyclingPool.Create <T>(); this.pipeline = pipeline; }
internal Receiver(object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.onReceived = onReceived; this.owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.cloner = RecyclingPool.Create <T>(); #if DEBUG this.debugTrace = new StackTrace(true); #endif }
internal Receiver(int id, string name, PipelineElement element, object owner, Action <Message <T> > onReceived, SynchronizationLock context, Pipeline pipeline, bool enforceIsolation = false) { this.scheduler = pipeline.Scheduler; this.schedulerContext = pipeline.SchedulerContext; this.lastEnvelope = default; this.onReceived = m => { this.lastEnvelope = m.Envelope; PipelineElement.TrackStateObjectOnContext(onReceived, owner, pipeline)(m); }; this.Id = id; this.Name = name; this.element = element; this.Owner = owner; this.syncContext = context; this.enforceIsolation = enforceIsolation; this.Recycler = RecyclingPool.Create <T>(); this.pipeline = pipeline; this.receiverDiagnosticsCollector = new Lazy <DiagnosticsCollector.ReceiverCollector>(() => this.pipeline.DiagnosticsCollector?.GetReceiverDiagnosticsCollector(pipeline, element, this), true); }
public PriorityQueueNode(int id) { this.id = id; this.simpleLock = new SynchronizationLock(this, false); }