On Wed, 19 May 2021 00:44:18 +0200, Martin Frb via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:

>Also CheckSyncronize afaik takes a timeout.
>So if you do not need to check the variables every millisecond, then do
>
>       While not (bSTerm or bSInt or bsHup) do
>       begin
>         //Here is where the server runs as defined elsewhere
>         //Eternal loop to wait for system messages
>         CheckSynchronize(50); //To get thread comm working
>       end;
>

So I tested by changing the loop to:

  While not (bSTerm or bSInt or bsHup) do
  begin
    //Here is where the server runs as defined elsewhere
    //Eternal loop to wait for system msg bSTerm, bSInt or bsHup
    CheckSynchronize(5); //To get thread comm working
  end;

It still worked as before so I can get rid of the sleep() but it still runs at
CPU = 6% while idling.

I guess this "proves" that the main loop is not what is causing this CPU usage.

Next I will search all of the code for instances of sleep() and see if there are
other CPU "thieves" around.


-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to