|
PeanutButter
|
Encapsulates some work which must be run in parallel. More...
Public Member Functions | |
| ParallelWorker (params Action[] workers) | |
| Provide some initial work. | |
| 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. | |
| 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 (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. | |
| ParallelWorker (params Func< T >[] workers) | |
| Provide some workers up-front. | |
| 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.Worker | |
| int | DefaultMaxDegreeOfParallelism = Environment.ProcessorCount [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). | |
Properties inherited from PeanutButter.Utils.IParallelWorker< T > | |
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). | |
Encapsulates some work which must be run in parallel.
| T |
| PeanutButter.Utils.ParallelWorker< T >.ParallelWorker | ( | params Action[] | workers | ) |
Provide some initial work.
| workers |
| PeanutButter.Utils.ParallelWorker< T >.ParallelWorker | ( | params Func< T >[] | workers | ) |
Provide some workers up-front.
| workers |
| void PeanutButter.Utils.ParallelWorker< 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.
| worker |
Implements PeanutButter.Utils.IParallelWorker< T >.
| void PeanutButter.Utils.ParallelWorker< T >.AddWorker | ( | Func< T > | worker | ) |
| void PeanutButter.Utils.ParallelWorker< 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.
| workers |
Implements PeanutButter.Utils.IParallelWorker< T >.
| void PeanutButter.Utils.ParallelWorker< T >.AddWorkers | ( | IEnumerable< Func< T > > | workers | ) |
| Exception[] PeanutButter.Utils.ParallelWorker< T >.RunAll | ( | ) |
Run all the queued work with the default max degree of parallelism.
Implements PeanutButter.Utils.IParallelWorker< T >.
| WorkResult< T >[] PeanutButter.Utils.ParallelWorker< T >.RunAll | ( | ) |
Run all the queued work with the default max degree of parallelism.
Implements PeanutButter.Utils.IParallelWorker< T >.
| Exception[] PeanutButter.Utils.ParallelWorker< T >.RunAll | ( | int | maxDegreeOfParallelism | ) |
Run all the queued work with the provided max degree of parallelism.
Implements PeanutButter.Utils.IParallelWorker< T >.
| WorkResult< T >[] PeanutButter.Utils.ParallelWorker< T >.RunAll | ( | int | maxDegreeOfParallelism | ) |
Run all the queued work with the provided max degree of parallelism.
| maxDegreeOfParallelism |
| InvalidOperationException |
Implements PeanutButter.Utils.IParallelWorker< T >.
|
get |
Will be true whilst the worker is busy.
Implements PeanutButter.Utils.IParallelWorker< T >.