| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Proposal: Add a callback data parameter to GetNamedDSMSegment |
| Date: | 2025-12-03 18:06:51 |
| Message-ID: | CAN4CZFMjh8TrT9ZhWgjVTzBDkYZi2a84BnZ8bM+fLPuq7Cirzg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello hackers,
While developing an extension and trying to write some generic code
around DSM areas, I noticed a limitation: although GetNamedDSMSegment
accepts a callback function, there is no way to pass additional
arguments to that callback.
For example, the documentation for creating LWLocks after startup [1]
suggests creating locks in this callback. That works fine as long as
the callback only needs to create a hardcoded lock. But if the lock
name is a parameter to the function calling GetNamedDSMSegment, and
not fixed, I do not see a clean way to pass it through to the callback
(short of relying on global variables, for example).
As a proper solution for this, and possibly for other similar issues,
I propose adding a generic callback argument to GetNamedDSMSegment
that can be forwarded to the callback function.
What do you think about this?
[1] https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-ADDIN-LWLOCKS-AFTER-STARTUP
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-a-callback-data-parameter-to-GetNamedDSMSegment.patch | application/octet-stream | 7.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sami Imseih | 2025-12-03 18:14:25 | Re: Support loser tree for k-way merge |
| Previous Message | Mihail Nikalayeu | 2025-12-03 18:04:02 | Re: Simplify code building the LR conflict messages |