You are here: Symbol Reference > MtxForLoop Namespace > Structs, Records, Enums > MtxForLoop.TThreadingMode Enumeration
MtxVec VCL
ContentsIndex
PreviousUpNext
MtxForLoop.TThreadingMode Enumeration

Specifies threading mode for TMtxForLoop.

Pascal
TThreadingMode = ( tmForLoop, tmWhileLoop, tmGreedyForLoop );
Members 
Description 
tmForLoop 
Call the functions and methods assigned to the for loop even properties. The mode assumes symmetric loads being distributed among threads. For each LoopIndex the computational load is expected to remain relatively constant. Further vectorization across a range of LoopIndex values within threads is still possible. This mode allows highest performance. 
tmWhileLoop 
Call the functions and methods assigned to the while loop event properties. This mode requires that each thread is signaled as finished by the user. The callback has a Stop parameter for this purpose. 
tmGreedyForLoop 
Call the functions and methods assigned to the for loop event properties. This mode is designed for asymmetric loads being distributed among threads. For each LoopIndex the computational load is allowed to vary (possibly by a lot). Further vectorization across a range of LoopIndex values within threads is not possible. 

Before starting threads, check first what threading mode would you like to use that would serve your application best. LoopIndex mentioned below is the counter, which runs from Min to Max and each LoopIndex value can be called by a different thread. The multithreaded job is finished when all threads together covered all LoopIndex values.

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