#1 2017-04-30 22:10:58

PBa
Member
From: Austria
Registered: 2017-01-04
Posts: 18

Bug in TSynBackgroundTimer.WaitUntilNotProcessing

Dear ab,

IMHO there is a bug in this newly introduced function (line 62827 in SynCommons.pas in commit {3638})

procedure TSynBackgroundTimer.WaitUntilNotProcessing(timeoutsecs: integer);
var timeout: Int64;
begin
  timeout := GetTickCount64+timeoutsecs*1000;
  while not Processing and (GetTickcount64<timeout) do
    SleepHiRes(1);
end;

This function is intended to wait until no background task is processed, but currently it waits until a background task is processed.
IMHO "not" should be deleted within the while loop.

  while Processing and (GetTickcount64<timeout) do 

Best regards,
Paul

Offline

#2 2017-04-30 22:38:54

PBa
Member
From: Austria
Registered: 2017-01-04
Posts: 18

Re: Bug in TSynBackgroundTimer.WaitUntilNotProcessing

I just saw that you've already changed this code in commit {3639} to

  while Processing and (GetTickcount64>timeout) do 

But shouldn't it be

  while Processing and (GetTickcount64<timeout) do 

to work as expected?

Paul

Offline

#3 2017-05-01 09:06:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bug in TSynBackgroundTimer.WaitUntilNotProcessing

You are perfectly right.
I made the fix locally on my PC, but the commit wasn't pushed because I compared only by size, not by content, so the > changed into < was not tracked!
My bad!
See https://synopse.info/fossil/info/6424e0d8bc

Thanks for the feedback!
smile

Offline

Board footer

Powered by FluxBB