Re: convert various variables to atomics

From: Andres Freund <andres(at)anarazel(dot)de>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: convert various variables to atomics
Date: 2026-07-22 13:19:39
Message-ID: ycvruij7554tlhw6w7bg4lqtibd52qguo52iojyou7ejdv5jrm@qyyr5f3hdsue
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-07-22 09:06:44 -0400, Nathan Bossart wrote:
> On Wed, Jul 22, 2026 at 02:31:49PM +0200, Peter Eisentraut wrote:
> > Here is an instance that seems obviously wrong:
> >
> > /* Buffer id of the buffer that Startup process waits for pin on, or -1 */
> > - int startupBufferPinWaitBufId;
> > + pg_atomic_uint32 startupBufferPinWaitBufId;
>
> I may just be undercaffeinated, but what is wrong with this case? AFAICT
> the casting should work as expected, and I see other examples that do
> something similar, like avLauncherProc.

The comment says -1, which doesn't really make sense for an unsigned variable.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2026-07-22 13:31:49 Re: convert various variables to atomics
Previous Message Andres Freund 2026-07-22 13:18:30 Re: [PATCH] Fix memory leak in pg_config