Re: pg_usleep for multisecond delays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_usleep for multisecond delays
Date: 2023-02-10 15:18:34
Message-ID: 4077536.1676042314@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I somehow feel that we should be trying to get rid of cases where
> WaitLatch is not desired.

+1

> 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.

Resetting the latch seems not very friendly for general-purpose use
... although I guess we could set it again on the way out.

BTW, we have an existing pg_sleep() function that deals with all
of this except re-setting the latch.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-02-10 15:21:49 Re: run pgindent on a regular basis / scripted manner
Previous Message Robert Haas 2023-02-10 14:58:25 Re: pg_usleep for multisecond delays