Table of Contents

ForAsync Method

Definition

Namespace
Cuemon.Threading
Assemblies
Cuemon.Threading.dll
Source
src/Cuemon.Threading/ParallelFactory.ForAsync.cs

ForAsync(int, int, Func<int, CancellationToken, Task>, Action<AsyncWorkloadOptions>)

Executes a parallel for loop.

public static Task ForAsync(int fromInclusive, int toExclusive, Func<int, CancellationToken, Task> worker, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, CancellationToken, Task>

The delegate that is invoked once per iteration.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

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

Executes a parallel for loop.

public static Task ForAsync<T>(int fromInclusive, int toExclusive, Func<int, T, CancellationToken, Task> worker, T arg, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, T, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg T

The parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T

The type of the parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2>(int fromInclusive, int toExclusive, Func<int, T1, T2, CancellationToken, Task> worker, T1 arg1, T2 arg2, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, T1, T2, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3>(int fromInclusive, int toExclusive, Func<int, T1, T2, T3, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, T1, T2, T3, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3, T4>(int fromInclusive, int toExclusive, Func<int, T1, T2, T3, T4, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, T1, T2, T3, T4, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

arg4 T4

The fourth parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

T4

The type of the fourth parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3, T4, T5>(int fromInclusive, int toExclusive, Func<int, T1, T2, T3, T4, T5, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive int

The start index, inclusive.

toExclusive int

The end index, exclusive.

worker Func<int, T1, T2, T3, T4, T5, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

arg4 T4

The fourth parameter of the delegate worker.

arg5 T5

The fifth parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

T4

The type of the fourth parameter of the delegate worker.

T5

The type of the fifth parameter of the delegate worker.

ForAsync(long, long, Func<long, CancellationToken, Task>, Action<AsyncWorkloadOptions>)

Executes a parallel for loop.

public static Task ForAsync(long fromInclusive, long toExclusive, Func<long, CancellationToken, Task> worker, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, CancellationToken, Task>

The delegate that is invoked once per iteration.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

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

Executes a parallel for loop.

public static Task ForAsync<T>(long fromInclusive, long toExclusive, Func<long, T, CancellationToken, Task> worker, T arg, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, T, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg T

The parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T

The type of the parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2>(long fromInclusive, long toExclusive, Func<long, T1, T2, CancellationToken, Task> worker, T1 arg1, T2 arg2, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, T1, T2, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3>(long fromInclusive, long toExclusive, Func<long, T1, T2, T3, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, T1, T2, T3, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3, T4>(long fromInclusive, long toExclusive, Func<long, T1, T2, T3, T4, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, T1, T2, T3, T4, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

arg4 T4

The fourth parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

T4

The type of the fourth parameter of the delegate worker.

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

Executes a parallel for loop.

public static Task ForAsync<T1, T2, T3, T4, T5>(long fromInclusive, long toExclusive, Func<long, T1, T2, T3, T4, T5, CancellationToken, Task> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Action<AsyncWorkloadOptions> setup = null)

Parameters

fromInclusive long

The start index, inclusive.

toExclusive long

The end index, exclusive.

worker Func<long, T1, T2, T3, T4, T5, CancellationToken, Task>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the delegate worker.

arg2 T2

The second parameter of the delegate worker.

arg3 T3

The third parameter of the delegate worker.

arg4 T4

The fourth parameter of the delegate worker.

arg5 T5

The fifth parameter of the delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Type Parameters

T1

The type of the first parameter of the delegate worker.

T2

The type of the second parameter of the delegate worker.

T3

The type of the third parameter of the delegate worker.

T4

The type of the fourth parameter of the delegate worker.

T5

The type of the fifth parameter of the delegate worker.