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

2019-03-13 Thread Magnus Hagander
On Tue, Mar 12, 2019 at 6:13 PM Tom Lane wrote: > Robert Haas writes: > > On Mon, Mar 11, 2019 at 8:03 PM Tom Lane 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.

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

2019-03-12 Thread Tom Lane
Robert Haas writes: > On Tue, Mar 12, 2019 at 1:13 PM Tom Lane wrote: >> (I'm not sure what I think about which behavior is really more >> desirable. We can debate that if there's actually a plausible >> choice to be made, which seems to depend on Windows.) > Yeah, that's a fair question. My

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

2019-03-12 Thread Andres Freund
Hi, On March 12, 2019 10:17:19 AM PDT, Robert Haas wrote: >On Tue, Mar 12, 2019 at 1:13 PM Tom Lane wrote: >> (I'm not sure what I think about which behavior is really more >> desirable. We can debate that if there's actually a plausible >> choice to be made, which seems to depend on Windows.)

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

2019-03-12 Thread Robert Haas
On Tue, Mar 12, 2019 at 1:13 PM Tom Lane wrote: > (I'm not sure what I think about which behavior is really more > desirable. We can debate that if there's actually a plausible > choice to be made, which seems to depend on Windows.) Yeah, that's a fair question. My motivation for asking was

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

2019-03-12 Thread Tom Lane
Robert Haas writes: > On Mon, Mar 11, 2019 at 8:03 PM Tom Lane 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

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

2019-03-12 Thread Robert Haas
On Mon, Mar 11, 2019 at 8:03 PM Tom Lane 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 >

Use nanosleep(2) in pg_usleep, if available?

2019-03-11 Thread Tom Lane
In the thread about vacuum_cost_delay vs vacuum_cost_limit, I wondered whether nanosleep(2) would provide any better timing resolution than select(2). Some experimentation suggests that it doesn't, but nonetheless I see a good reason why we should consider making pg_usleep use nanosleep() if