Re: pg_usleep for multisecond delays

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: pg_usleep for multisecond delays
Дата
Msg-id 20230209225114.GB724381@nathanxps13
обсуждение исходный текст
Ответ на Re: pg_usleep for multisecond delays  (Andres Freund <andres@anarazel.de>)
Ответы Re: pg_usleep for multisecond delays
Re: pg_usleep for multisecond delays
Список pgsql-hackers
On Thu, Feb 09, 2023 at 01:30:27PM -0800, Andres Freund wrote:
> On 2023-02-09 12:59:29 -0800, Nathan Bossart wrote:
>> I just found myself carefully counting the zeros in a call to pg_usleep().
>> Besides getting my eyes checked, perhaps there should be a wrapper called
>> pg_ssleep() than can be used for multisecond sleeps.  Or maybe the
>> USECS_PER_SEC macro should be used more widely.  I attached a patch for the
>> former approach.  I don't have a strong opinion, but I do think it's worth
>> improving readability a bit here.
> 
> pg_usleep() should pretty much never used for sleeps that long, at least in
> the backend - depending on the platform they're not interruptible. Most of the
> things changed here are debugging tools, but even so, it's e.g. pretty
> annoying. E.g. you can't normally shut down while a backend is in
> pre_auth_delay.
> 
> So I'm not sure it's the right direction to make pg_usleep() easier to use...

Hm...  We might be able to use WaitLatch() for some of these.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Generating code for query jumbling through gen_node_support.pl
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Worth using personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND on linux?