|
PeanutButter
|
Encapsulates some work which must be run in parallel. More...
Public Member Functions | |
| 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). | |
Encapsulates some work which must be run in parallel.
| T |
| void PeanutButter.Utils.ParallelWorker< T >.AddWorker | ( | Func< T > | worker | ) |
| void PeanutButter.Utils.ParallelWorker< T >.AddWorkers | ( | IEnumerable< Func< T > > | workers | ) |
| PeanutButter.Utils.ParallelWorker< T >.ParallelWorker | ( | params Func< T >[] | workers | ) |
Provide some workers up-front.
| workers |
| WorkResult< T >[] 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 | ( | 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 >.