procedure WaitForProcessingFinish(ProcessMessages: Boolean);
Blocking which will not return until all threads have done processing and are running idle.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | ProcessMessages | Boolean |
Result: stored in self (calling object)
Remarks:
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.
Examples
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: TObject ; //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;