Class ParallelProcessor<TParallelizedProcessor>
Processer that can run multiple ParallelizedProcessor instances in parallel.
Implements
Inherited Members
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 |
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.