PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.IParallelWorker< T > Interface Template Reference

Describes a parallel worker for actions. More...

Inheritance diagram for PeanutButter.Utils.IParallelWorker< T >:
PeanutButter.Utils.IWorker PeanutButter.Utils.ParallelWorker< int > PeanutButter.Utils.ParallelWorker< T > PeanutButter.Utils.ParallelWorker< T >

Public Member Functions

void AddWorkers (IEnumerable< Action > workers)
 Add some workers to the queue. If the work is already running, they will be added to the end and executed when the queue is complete.
 
void AddWorker (Action worker)
 Add a single worker to the queue. If the work is already running, it will be added to the end and executed when the queue is complete.
 
Exception[] RunAll ()
 Run all the queued work with the default max degree of parallelism.
 
Exception[] RunAll (int maxDegreeOfParallelism)
 Run all the queued work with the provided max degree of parallelism.
 
void AddWorker (Func< T > worker)
 Add a single worker.
 
void AddWorkers (IEnumerable< Func< T > > workers)
 Add a bunch of workers.
 
WorkResult< T >[] RunAll ()
 Run all the queued work with the default max degree of parallelism.
 
WorkResult< T >[] RunAll (int maxDegreeOfParallelism)
 Run all the queued work with the provided max degree of parallelism.
 

Properties

bool Busy [get]
 Will be true whilst the worker is busy.
 
- Properties inherited from PeanutButter.Utils.IWorker
int DefaultMaxDegreeOfParallelism [get, set]
 Indicates the default MaxDegreeOfParallelism for ParallelWorker (should default to the number of available cores, on the assumption that workloads are more often cpu-bound than I/O-bound).
 

Detailed Description

Describes a parallel worker for actions.

Describes a parallel worker for functions returning values.

Template Parameters
T

Member Function Documentation

◆ AddWorker() [1/2]

void PeanutButter.Utils.IParallelWorker< T >.AddWorker ( Action  worker)

Add a single worker to the queue. If the work is already running, it will be added to the end and executed when the queue is complete.

Parameters
worker

Implemented in PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ AddWorker() [2/2]

void PeanutButter.Utils.IParallelWorker< T >.AddWorker ( Func< T >  worker)

Add a single worker.

Parameters
worker

Implemented in PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ AddWorkers() [1/2]

void PeanutButter.Utils.IParallelWorker< T >.AddWorkers ( IEnumerable< Action >  workers)

Add some workers to the queue. If the work is already running, they will be added to the end and executed when the queue is complete.

Parameters
workers

Implemented in PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ AddWorkers() [2/2]

void PeanutButter.Utils.IParallelWorker< T >.AddWorkers ( IEnumerable< Func< T > >  workers)

Add a bunch of workers.

Parameters
workers

Implemented in PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ RunAll() [1/4]

Exception[] PeanutButter.Utils.IParallelWorker< T >.RunAll ( )

Run all the queued work with the default max degree of parallelism.

Returns

Implemented in PeanutButter.Utils.ParallelWorker< T >, PeanutButter.Utils.ParallelWorker< int >, PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ RunAll() [2/4]

◆ RunAll() [3/4]

Exception[] PeanutButter.Utils.IParallelWorker< T >.RunAll ( int  maxDegreeOfParallelism)

Run all the queued work with the provided max degree of parallelism.

Returns

Implemented in PeanutButter.Utils.ParallelWorker< T >, PeanutButter.Utils.ParallelWorker< int >, PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

◆ RunAll() [4/4]

WorkResult< T >[] PeanutButter.Utils.IParallelWorker< T >.RunAll ( int  maxDegreeOfParallelism)

Run all the queued work with the provided max degree of parallelism.

Parameters
maxDegreeOfParallelism
Returns
Exceptions
InvalidOperationException

Implemented in PeanutButter.Utils.ParallelWorker< T >, PeanutButter.Utils.ParallelWorker< int >, PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.

Property Documentation

◆ Busy

Will be true whilst the worker is busy.

Implements PeanutButter.Utils.IWorker.

Implemented in PeanutButter.Utils.ParallelWorker< T >, and PeanutButter.Utils.ParallelWorker< int >.


The documentation for this interface was generated from the following file: