Re: pg_usleep for multisecond delays

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: pg_usleep for multisecond delays
Дата
Msg-id CA+TgmoYmzveX1L2YG2Syogz5rfGMrBfo04OKC=LSz5HGO1qUEw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_usleep for multisecond delays  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: pg_usleep for multisecond delays  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Feb 10, 2023 at 3:30 AM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Maybe for these cases where a WaitLatch is not desired, it'd be simpler
> to do pg_usleep (5L * 1000 * 1000);

I somehow feel that we should be trying to get rid of cases where
WaitLatch is not desired.

That's probably overly simplistic - there might be cases where the
caller isn't just polling and has a really legitimate need to wait for
5 seconds of wall clock time. But even in that case, it seems like we
want to respond to barriers and interrupts during that time, in almost
all cases.

I wonder if we should have a wrapper around WaitLatch() that documents
that if the latch is set before the time expires, it will reset the
latch and try again to wait for the remaining time, after checking for
interrupts etc.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Support logical replication of DDLs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_usleep for multisecond delays