Show / Hide Table of Contents

Class ParallelProcessor<TParallelizedProcessor>

Processer that can run multiple ParallelizedProcessor instances in parallel.

Inheritance
object
ParallelProcessor<TParallelizedProcessor>
Implements
IParallelizedProcessorControlPlane
IParallelProcessor<TParallelizedProcessor>
IHostedService
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public class ParallelProcessor<TParallelizedProcessor> : IParallelizedProcessorControlPlane, IParallelProcessor<TParallelizedProcessor>, IHostedService where TParallelizedProcessor : ParallelizedProcessor
Type Parameters
Name Description
TParallelizedProcessor

Processor responsible for processing in parallel.

Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

Constructors

ParallelProcessor(IServiceProvider, ILogger<ParallelProcessor<TParallelizedProcessor>>)

Default constructor

Declaration
public ParallelProcessor(IServiceProvider serviceProvider, ILogger<ParallelProcessor<TParallelizedProcessor>> logger)
Parameters
Type Name Description
IServiceProvider serviceProvider

Service provider instance used for creating TParallelizedProcessor using CreateInstance<T>(IServiceProvider, params object[])

ILogger<ParallelProcessor<TParallelizedProcessor>> logger
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

Properties

CurrentNumberOfProcessors

Current number of Parellel processing tasks

Declaration
public int CurrentNumberOfProcessors { get; }
Property Value
Type Description
int
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

DesiredNumberOfProcessors

Desired number of parallel processing tasks

Declaration
public int DesiredNumberOfProcessors { get; }
Property Value
Type Description
int
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

Methods

SetDesiredNumberOfProcessors(int)

Set the desired number of parallel processing tasks

Declaration
public void SetDesiredNumberOfProcessors(int desiredNumberOfProcessors)
Parameters
Type Name Description
int desiredNumberOfProcessors
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

StartAsync(CancellationToken)

Processer that can run multiple ParallelizedProcessor instances in parallel.

Declaration
public Task StartAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

StopAsync(CancellationToken)

Processer that can run multiple ParallelizedProcessor instances in parallel.

Declaration
public Task StopAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

This can either run as a hosted service or be manually controlled. When running as a hosted service, an type inhetidet from the ParallelProcessor<TParallelizedProcessor> must be added as a Hosted Service as a service collection. When running manually, the instance shuould be obtained with DI, ClassFacotry or directly throug asn instance of IServiceProvider.

Implements

IParallelizedProcessorControlPlane
IParallelProcessor<TParallelizedProcessor>
IHostedService

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top