Skip to content
On this page

Shuttle.Core.Threading

PM> Install-Package Shuttle.Core.Threading

Provides various classes and interfaces to facilitate thread-based processing.

ProcessorThreadPool

c#
public ProcessorThreadPool(string name, int threadCount, IProcessorFactory processorFactory, ProcessorThreadOptions processorThreadOptions);

Each thread pool has a name used only for identyfing the pool. The threadCount determines the number of ProcessorThread instances in the pool. Each ProcessorThread calls the IProcessor.Execute(CancellationToken) instance provided by the IProcessorFactory.Create() method in a loop while the CancellationToken.IsCancellationRequested returns false.

ProcessorThreadOptions

OptionDefaultDescription
JoinTimeout00:00:15The duration to allow the processor thread to join the main thread.
IsBackgroundtrueIndicates whether the thread will be started as a background thread. Background threads are instantly killed when the host process stops.
PriorityThreadPriority.NormalIndicates the thread priority.
Shuttle.Core.Threading has loaded