Skip to content

M_CodeJam_Threading_ParallelExtensions_RunInParallel__2_3

andrewvk edited this page Jul 1, 2016 · 7 revisions

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

Implements Provider-Consumer pattern.

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

Syntax

C#

public static void RunInParallel<TSource, TTarget>(
	this IEnumerable<TSource> source,
	int providerCount,
	Func<TSource, TTarget> providerFunc,
	int consumerCount,
	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),
	consumerCount As Integer,
	consumerAction As Action(Of TTarget),
	Optional processName As String = "ParallelProcess"
)

F#

[<ExtensionAttribute>]
static member RunInParallel : 
        source : IEnumerable<'TSource> * 
        providerCount : int * 
        providerFunc : Func<'TSource, 'TTarget> * 
        consumerCount : int * 
        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
consumerCount
Type: System.Int32
Number of consumer threads.
consumerAction
Type: System.Action(TTarget)
Consumer action.
processName (Optional)
Type: System.String
Process name pattern.

Type Parameters

 

TSource
TTarget

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