You are here: Symbol Reference > MtxForLoop Namespace > Classes > TMtxForLoop Class > public > TMtxForLoop.WaitForProcessingFinish Method
MtxVec VCL
ContentsIndex
PreviousUpNext
TMtxForLoop.WaitForProcessingFinish Method

Blocking which will not return until all threads have done processing and are running idle.

Pascal
procedure WaitForProcessingFinish(ProcessMessages: boolean = false);

If ProcessMessages is true, the main thread will not be blocked. However, the recommended method to allow monitoring of the progress of the computation is not to call Start from the main thread. Use a separate thread for that purpose. See example below.

procedure TExecuteThread.Execute; var am: Matrix; begin am.Size(1001,100); am.SetVal(1); DoForLoop(0,1000, ForLoopForm.MyLoop, forLoop,[TMtx(am)]); end; procedure TForLoopForm.Button2Click(Sender: TObject); var aThread: TThread; //needed only to allow monitoring of execution begin Timer.OnTimer := Timer1Timer; Timer.Enabled := true; //start the timer which will update the display aThread := TExecuteThread.Create(true); aThread.FreeOnTerminate := True; aThread.OnTerminate := OnComputationEnded; aThread.Resume; end; procedure TForLoopForm.Timer1Timer(Sender: TObject); begin Label1.Caption := 'Loop running time: ' + IntToStr(ForLoop.LoopRunningTime) + 'ms'; end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!