You are here: Symbol Reference > MtxForLoop Namespace > Types > MtxForLoop.TForLoopRangeEvent Type
MtxVec VCL
ContentsIndex
PreviousUpNext
MtxForLoop.TForLoopRangeEvent Type

Event type to implement threaded for-loop within a function.

Pascal
TForLoopRangeEvent = procedure (IdxMin, IdxMax: integer; const Context: TObjectArray; ThreadIndex: integer) of object;

IdxMin specifies the starting and IdxMax the final iteration of the for-loop from the [IterMin ... IterMax] range defined when DoForLoop was called. The function is called only once for each thread, because TMtxForLoop component partitions the [IterMin ... IterMax] range as equaly as possible across the threads. The context contains any parameters passed to the DoForLoop function,when threading was initialized. The advantage of having both starting and final index available is the possiblity for additional code vectorization within the threaded function. ThreadIndex parameter will vary from 0 to ThreadCount-1 depending on the thread, that is running. ThreadIndex can be used to partition the data within the event.

Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!