Re: Restart pg_usleep when interrupted

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(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-08-07 14:36:59
Message-ID: ZrOGi8RZTSHxTq9W@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 07, 2024 at 06:00:53AM +0000, Bertrand Drouvot wrote:
> + SleepEx((microsec < 500 ? 1 : (microsec + 500) / 1000), FALSE);

I think this deserves a comment.

> +#define INSTR_TIME_ADD_MICROSEC(x,t) \
> + ((x).ticks += t * NS_PER_US)

I'd add parentheses around "t" to ensure any expressions given as "t" are
evaluated first.

Also, do we need to worry about overflow here? It looks like the rest of
instr_time.h is oblivious about overflow, so maybe this is better discussed
in a separate thread...

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vitaly Davydov 2024-08-07 14:37:39 Re: Fsync (flush) all inserted WAL records
Previous Message Bertrand Drouvot 2024-08-07 14:23:41 Re: Restart pg_usleep when interrupted