From f0c3b6506e040933d2466ee4061f29a9a946a155 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Mon, 13 Mar 2023 09:50:06 +1300 Subject: [PATCH 2/3] Update obsolete comment about pg_usleep() accuracy. There are still some systems that use traditional tick or jiffy-based sleep timing, but many including Linux (see "man 7 time"), FreeBSD and macOS are limited only by the accuracy of the available timer hardware and system load. Update our comment about that, which previously said that most Unix systems had that design. Also mention that Windows is like the older Unixen in this respect. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/CA%2BhUKG%2BogAon8_V223Ldv6taPR2uKH3X_UJ_A7LJAf3-VRARPA%40mail.gmail.com --- src/port/pgsleep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/port/pgsleep.c b/src/port/pgsleep.c index 8a709cd01d..dcba7eda44 100644 --- a/src/port/pgsleep.c +++ b/src/port/pgsleep.c @@ -26,8 +26,9 @@ * pg_usleep --- delay the specified number of microseconds. * * NOTE: although the delay is specified in microseconds, the effective - * resolution is only 1/HZ, or 10 milliseconds, on most Unixen. Expect - * the requested delay to be rounded up to the next resolution boundary. + * resolution is only 1/HZ on systems that use periodic kernel ticks to wake + * up. This may cause sleeps to be rounded up by 1-20 milliseconds on older + * Unixen and Windows. * * On machines where "long" is 32 bits, the maximum delay is ~2000 seconds. * -- 2.39.2