From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Restart pg_usleep when interrupted |
Date: | 2024-07-12 19:18:37 |
Message-ID: | ZpGBjZZtbDGUtvTV@nathan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jul 12, 2024 at 12:14:56PM -0500, Sami Imseih wrote:
> 1/ TimestampDifference has a dependency on gettimeofday,
> while my proposal utilizes clock_gettime. There are old discussions
> that did not reach a conclusion comparing both mechanisms.
> My main conclusion from these hacker discussions [1], [2] and other
> online discussions on the topic is clock_gettime should replace
> getimeofday when possible. Precision is the main reason.
>
> 2/ It no longer uses the remain time. I think the remain time
> is still required here. I did a unrealistic stress test which shows
> the original proposal can handle frequent interruptions much better.
My comment was mostly about coding style and not about gettimeofday()
versus clock_gettime(). What does your testing show when you don't have
the extra check, i.e.,
struct timespec delay;
struct timespec remain;
delay.tv_sec = microsec / 1000000L;
delay.tv_nsec = (microsec % 1000000L) * 1000;
while (nanosleep(&delay, &remain) == -1 && errno == EINTR)
delay = remain;
--
nathan
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2024-07-12 20:03:33 | Re: Add support to TLS 1.3 cipher suites and curves lists |
Previous Message | Tomas Vondra | 2024-07-12 18:16:42 | Re: Amcheck verification of GiST and GIN |