Class ParallelWorkQueue

Public

Helper for parallelizing tasks.

More specifically this class is useful if the tasks need some large and slow to initialize 'scratch pad'. Using this class you can initialize a scratch pad per thread and then use the appropriate one in the task callback (which includes a thread index).

Any exception that is thrown in the worker threads will be propagated out to the caller of the Run method.

Public Methods

ParallelWorkQueue (queue)
Public
Run (progressTimeoutMillis)

Execute the tasks.

Public

Public Variables

action

Callback to run for each item in the queue.

Public
threadCount

Number of threads to use.

Public Readonly

Private/Protected Members

RunTask (threadIndex)
Private
initialCount
Private Readonly
innerException
Private
queue

Queue of items.

Private Readonly
waitEvents
Private