Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Add a callback data parameter to GetNamedDSMSegment
Date: 2025-12-12 21:07:22
Message-ID: aTyECsCvicaF40iA@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 12, 2025 at 02:56:39PM -0600, Sami Imseih wrote:
> fair point. In that case why don't we just keep:
>
> [...]
> - LWLockInitialize(&dsm->lck, LWLockNewTrancheId("test_dsm_registry"));
> + LWLockInitialize(&dsm->lck, LWLockNewTrancheId((char *) arg));
> dsm->val = 0;
> [...]
>
> instead of creating a new test? For the other GetNamedDSMSegment calls,
> I'll pass NULL to the void * and hard code the tranche name in the init
> callback.

I think we should verify the pointer value more directly. For example, we
could pass something like (uintptr_t) 0x12345 via the callback argument and
then verify it's the same in the callback.

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-12-12 21:47:30 Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Previous Message Zsolt Parragi 2025-12-12 21:07:04 Re: Proposal: Add a callback data parameter to GetNamedDSMSegment