Am 10.08.2012 14:43, schrieb Michael Schnell:
On 08/10/2012 02:38 PM, michael.vancann...@wisa.be wrote:
  while not fStopExecution do
    begin
    CheckSynchronize;
    inc(i);
    end;
This results in 100 % CPU (in a single CPU system) so not a very good
idea IMHO. (Even the timer thread is crippled by the main thread.)

If you can live with some latency I would do something like:

    while not fStopExecution do
      begin
      CheckSynchronize;
      sleep(Max_Latancy);
      end;

You know that the "inc(i)" in the above code is where the author's calculation takes place? So the "CheckSynchronize" call would just be between different calculation steps where it's safe to have the execution stopped (though it might be better to put the "CheckSynchronize" to the end of the loop).

Regards,
Sven


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to