Re: Use nanosleep(2) in pg_usleep, if available?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use nanosleep(2) in pg_usleep, if available?
Date: 2019-03-12 16:59:44
Message-ID: CA+TgmobkuSFwu9yvL5UxPrY-4OgFc5--p0os=qy8BHmfjGPWGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 11, 2019 at 8:03 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> While the WaitLatch alternative avoids the problem, I doubt
> we're ever going to remove pg_usleep entirely, so it'd be
> good if it had fewer sharp edges. nanosleep() has the
> same behavior as Windows, ie, the sleep is guaranteed to be
> terminated by a signal. So if we used nanosleep() where available
> we'd have that behavior on just about every interesting platform.

Is there any feasible way to go the other way, and make pg_usleep()
actually always sleep for the requested time, rather than terminating
early?

(Probably not, but I'm just asking.)

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-03-12 17:05:20 Re: Timeout parameters
Previous Message Tom Lane 2019-03-12 16:50:19 Re: Why don't we have a small reserved OID range for patch revisions?