MtxForLoop.ThreadedWhileLoop Method

function ThreadedWhileLoop(MyLoop: TWhileLoopEvent; Threads: TMtxForLoop; const Context: TObjectArray): Boolean;

Call this function to initiate threaded while-loop.

#NameTypeDescription
1MyLoopTWhileLoopEvent
2ThreadsTMtxForLoop
3ContextTObjectArray

Returns: Boolean

Remarks:

The MyLoop method pointer must be a function (not object method). This is the function that will be called until Stop parameter of MyLoop will be returned as True. Threads parameter requires a TMtxForLoop object and Context can be used to pass any parameters to the threaded function.

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