Skip to content

M_CodeJam_Threading_ParallelExtensions_RunInParallel__2_2

Andrew Koryavchenko edited this page Jun 17, 2018 · 7 revisions

ParallelExtensions.RunInParallel(TSource, TTarget) Method (IEnumerable(TSource), Int32, Func(TSource, TTarget), Action(TTarget), String)

Implements Provider-Consumer pattern.

Namespace: CodeJam.Threading
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static void RunInParallel<TSource, TTarget>(
	this IEnumerable<TSource> source,
	int providerCount,
	Func<TSource, TTarget> providerFunc,
	Action<TTarget> consumerAction,
	string processName = "ParallelProcess"
)

VB

<ExtensionAttribute>
Public Shared Sub RunInParallel(Of TSource, TTarget) ( 
	source As IEnumerable(Of TSource),
	providerCount As Integer,
	providerFunc As Func(Of TSource, TTarget),
	consumerAction As Action(Of TTarget),
	Optional processName As String = "ParallelProcess"
)

F#

[<ExtensionAttribute>]
static member RunInParallel : 
        source : IEnumerable<'TSource> * 
        providerCount : int * 
        providerFunc : Func<'TSource, 'TTarget> * 
        consumerAction : Action<'TTarget> * 
        ?processName : string 
(* Defaults:
        let _processName = defaultArg processName "ParallelProcess"
*)
-> unit 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(TSource)
Incoming data.
providerCount
Type: System.Int32
Number of provider threads.
providerFunc
Type: System.Func(TSource, TTarget)
Provider function
consumerAction
Type: System.Action(TTarget)
Consumer action.
processName (Optional)
Type: System.String
Process name pattern.

Type Parameters

 

TSource
[Missing documentation for "M:CodeJam.Threading.ParallelExtensions.RunInParallel2(System.Collections.Generic.IEnumerable{0},System.Int32,System.Func{0,1},System.Action{1},System.String)"\]</dd><dt>TTarget</dt><dd>\[Missing <typeparam name="TTarget"/> documentation for "M:CodeJam.Threading.ParallelExtensions.RunInParallel2(System.Collections.Generic.IEnumerable{0},System.Int32,System.Func{0,1},System.Action{1},System.String)"]

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TSource). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

ParallelExtensions Class
RunInParallel Overload
CodeJam.Threading Namespace

Clone this wiki locally