Re: \watch 0 or \watch 0.00001 doesn't do what I want

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: \watch 0 or \watch 0.00001 doesn't do what I want
Дата
Msg-id 2423966.1728486183@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: \watch 0 or \watch 0.00001 doesn't do what I want  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> This issue is present on newer versions still.

Here's the problem:

    long        sleep_ms = (long) (sleep * 1000);

If "sleep" is less than 0.0005, sleep_ms rounds to zero, which
results in the subsequent setitimer disarming rather than
arming the interrupt.

There is an uncommented

        if (sleep == 0)
            continue;

in the loop, which I bet some cowboy added to fix the zero-wait
problem you complained of.  But it's doing the wrong thing because
it checks sleep not sleep_ms.

We should change this to test sleep_ms, and we should probably
fix the code that says what the wait interval is to print
sleep_ms/1000.0 not sleep.  And some more comments would be good.

            regards, tom lane



В списке pgsql-hackers по дате отправления: