MtxForLoop.ThreadedForLoop Method

Overload List

#SignatureDescription
1Boolean ThreadedForLoop(Int32 IterMin, Int32 IterMax, TForLoopEvent MyLoop, TMtxForLoop Threads, Object[] Context)Call this function to initiate threaded for-loop.
2Boolean ThreadedForLoop(Int32 IterMin, Int32 IterMax, TForLoopRangeEvent MyLoop, TMtxForLoop Threads, Object[] Context)Call this function to initiate threaded for-loop.

Overload 1: Boolean ThreadedForLoop(Int32 IterMin, Int32 IterMax, TForLoopEvent MyLoop, TMtxForLoop Threads, Object[] Context)

Call this function to initiate threaded for-loop.

#NameTypeDescription
1IterMinInt32
2IterMaxInt32
3MyLoopTForLoopEvent
4ThreadsTMtxForLoop
5ContextObject[]

Returns: Boolean

Remarks:

The MyLoop method pointer must be a method. This is the function that will be called (IterMax - IterMin + 1) times. Threads parameter requires a TMtxForLoop object and Context can be used to pass any parameters to the threaded function. Computational load for each Iteration in the range from IterMin to IterMax is allowed to vary (possibly by a lot). Further vectorization within each threaded function call is not possible across the working Iteration range.

Use MtxVec.DoForLoop to take advantage of super-conductive MtxVec object cache. Calling ThreadedForLoop in parallel from multiple threads will not work. The call is to be protected with a critical section or otherwise.

Overload 2: Boolean ThreadedForLoop(Int32 IterMin, Int32 IterMax, TForLoopRangeEvent MyLoop, TMtxForLoop Threads, Object[] Context)

Call this function to initiate threaded for-loop.

#NameTypeDescription
1IterMinInt32
2IterMaxInt32
3MyLoopTForLoopRangeEvent
4ThreadsTMtxForLoop
5ContextObject[]

Returns: Boolean

Remarks:

The MyLoop method pointer must be a method. This is the function that will be called once by each thread. Threads parameter requires a TMtxForLoop object and the Context parameter can be used to pass any parameters to the threaded function. The threading engine will attempt to equaly partition the job between available threads assuming constant computational load for each Iteration in the range from IterMin to IterMax. However, further vectorization is possible within each threaded function call.

Use MtxVec.DoForLoop to take advantage of super-conductive MtxVec object cache. Calling ThreadedForLoop in parallel from multiple threads will not work. The call is to be protected with a critical section or otherwise.