Table of Contents

AdvancedParallelFactory Class

Definition

Provides a factory based way to work with advanced scenarios that encapsulate and re-use existing code while adding support for typically long-running parallel loops and regions.

public static class AdvancedParallelFactory
Inheritance
AdvancedParallelFactory

Examples

The following example demonstrates using AdvancedParallelFactory to compute an iterator value and evaluate a loop condition. The output shows the result of 5 + 3 and whether that result satisfies the greater-than-or-equal check of 8.

using System;
using Cuemon.Threading;

namespace Cuemon.Threading;

public class AdvancedParallelFactoryExample
{
    public void Demonstrate()
    {
        var next = AdvancedParallelFactory.Iterator(5, AssignmentOperator.Addition, 3);
        Console.WriteLine($"5 + 3 = {next}");

        var isComplete = AdvancedParallelFactory.Condition(next, RelationalOperator.GreaterThanOrEqual, 8);
        Console.WriteLine($"Is loop condition met? {isComplete}");
    }
}

Methods

Name Description
Condition<T>(T, RelationalOperator, T)

Provides a default implementation of a for-condition callback method.

ForAsync<TOperand>(ForLoopRuleset<TOperand>, Func<TOperand, CancellationToken, Task>, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForAsync<TOperand, T>(ForLoopRuleset<TOperand>, Func<TOperand, T, CancellationToken, Task>, T, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForAsync<TOperand, T1, T2>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, CancellationToken, Task>, T1, T2, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForAsync<TOperand, T1, T2, T3>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, CancellationToken, Task>, T1, T2, T3, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForAsync<TOperand, T1, T2, T3, T4>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, CancellationToken, Task>, T1, T2, T3, T4, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForAsync<TOperand, T1, T2, T3, T4, T5>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, T5, CancellationToken, Task>, T1, T2, T3, T4, T5, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

ForResultAsync<TOperand, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, CancellationToken, Task<TResult>>, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResultAsync<TOperand, T, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T, CancellationToken, Task<TResult>>, T, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResultAsync<TOperand, T1, T2, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, CancellationToken, Task<TResult>>, T1, T2, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResultAsync<TOperand, T1, T2, T3, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, CancellationToken, Task<TResult>>, T1, T2, T3, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResultAsync<TOperand, T1, T2, T3, T4, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, CancellationToken, Task<TResult>>, T1, T2, T3, T4, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResultAsync<TOperand, T1, T2, T3, T4, T5, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>, T1, T2, T3, T4, T5, Action<AsyncWorkloadOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, TResult>, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, T, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T, TResult>, T, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, T1, T2, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, TResult>, T1, T2, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, T1, T2, T3, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, TResult>, T1, T2, T3, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, T1, T2, T3, T4, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, TResult>, T1, T2, T3, T4, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

ForResult<TOperand, T1, T2, T3, T4, T5, TResult>(ForLoopRuleset<TOperand>, Func<TOperand, T1, T2, T3, T4, T5, TResult>, T1, T2, T3, T4, T5, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections where the return value of the function delegate worker is stored in the same sequential order as the for loop.

For<TOperand>(ForLoopRuleset<TOperand>, Action<TOperand>, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

For<TOperand, T>(ForLoopRuleset<TOperand>, Action<TOperand, T>, T, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

For<TOperand, T1, T2>(ForLoopRuleset<TOperand>, Action<TOperand, T1, T2>, T1, T2, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

For<TOperand, T1, T2, T3>(ForLoopRuleset<TOperand>, Action<TOperand, T1, T2, T3>, T1, T2, T3, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

For<TOperand, T1, T2, T3, T4>(ForLoopRuleset<TOperand>, Action<TOperand, T1, T2, T3, T4>, T1, T2, T3, T4, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

For<TOperand, T1, T2, T3, T4, T5>(ForLoopRuleset<TOperand>, Action<TOperand, T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5, Action<AsyncTaskFactoryOptions>)

Executes a parallel for loop that offers control of the loop control variable and loop sections.

Iterator<T>(T, AssignmentOperator, T)

Provides a default implementation of a for-iterator callback method.

WhileAsync<TReader, TElement>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, CancellationToken, Task>, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileAsync<TReader, TElement, T>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T, CancellationToken, Task>, T, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileAsync<TReader, TElement, T1, T2>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, CancellationToken, Task>, T1, T2, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileAsync<TReader, TElement, T1, T2, T3>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, CancellationToken, Task>, T1, T2, T3, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileAsync<TReader, TElement, T1, T2, T3, T4>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, CancellationToken, Task>, T1, T2, T3, T4, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileAsync<TReader, TElement, T1, T2, T3, T4, T5>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, T5, CancellationToken, Task>, T1, T2, T3, T4, T5, Action<AsyncWorkloadOptions>)

Executes a parallel while loop.

WhileResultAsync<TReader, TElement, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, CancellationToken, Task<TResult>>, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResultAsync<TReader, TElement, T, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T, CancellationToken, Task<TResult>>, T, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResultAsync<TReader, TElement, T1, T2, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, CancellationToken, Task<TResult>>, T1, T2, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResultAsync<TReader, TElement, T1, T2, T3, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, CancellationToken, Task<TResult>>, T1, T2, T3, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResultAsync<TReader, TElement, T1, T2, T3, T4, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, CancellationToken, Task<TResult>>, T1, T2, T3, T4, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResultAsync<TReader, TElement, T1, T2, T3, T4, T5, TResult>(TReader, Func<Task<bool>>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>, T1, T2, T3, T4, T5, Action<AsyncWorkloadOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, TResult>, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, T, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, T, TResult>, T, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, T1, T2, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, T1, T2, TResult>, T1, T2, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, T1, T2, T3, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, TResult>, T1, T2, T3, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, T1, T2, T3, T4, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, TResult>, T1, T2, T3, T4, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

WhileResult<TReader, TElement, T1, T2, T3, T4, T5, TResult>(TReader, Func<bool>, Func<TReader, TElement>, Func<TElement, T1, T2, T3, T4, T5, TResult>, T1, T2, T3, T4, T5, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop where the return value of the function delegate worker is stored in the same order as the while loop evaluates true.

While<TReader, TElement>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement>, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

While<TReader, TElement, T>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement, T>, T, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

While<TReader, TElement, T1, T2>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement, T1, T2>, T1, T2, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

While<TReader, TElement, T1, T2, T3>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement, T1, T2, T3>, T1, T2, T3, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

While<TReader, TElement, T1, T2, T3, T4>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement, T1, T2, T3, T4>, T1, T2, T3, T4, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

While<TReader, TElement, T1, T2, T3, T4, T5>(TReader, Func<bool>, Func<TReader, TElement>, Action<TElement, T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5, Action<AsyncTaskFactoryOptions>)

Executes a parallel while loop.

See Also