mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Allow passing a pointer to GetNamedDSMSegment()'s init callback.
This commit adds a new "void *arg" parameter to GetNamedDSMSegment() that is passed to the initialization callback function. This is useful for reusing an initialization callback function for multiple DSM segments. Author: Zsolt Parragi <zsolt.parragi@percona.com> Reviewed-by: Sami Imseih <samimseih@gmail.com> Discussion: https://postgr.es/m/CAN4CZFMjh8TrT9ZhWgjVTzBDkYZi2a84BnZ8bM%2BfLPuq7Cirzg%40mail.gmail.com
This commit is contained in:
@@ -3696,15 +3696,18 @@ LWLockRelease(AddinShmemInitLock);
|
||||
use the shared memory should obtain a pointer to it by calling:
|
||||
<programlisting>
|
||||
void *GetNamedDSMSegment(const char *name, size_t size,
|
||||
void (*init_callback) (void *ptr),
|
||||
bool *found)
|
||||
void (*init_callback) (void *ptr, void *arg),
|
||||
bool *found, void *arg)
|
||||
</programlisting>
|
||||
If a dynamic shared memory segment with the given name does not yet
|
||||
exist, this function will allocate it and initialize it with the provided
|
||||
<function>init_callback</function> callback function. If the segment has
|
||||
already been allocated and initialized by another backend, this function
|
||||
simply attaches the existing dynamic shared memory segment to the current
|
||||
backend.
|
||||
backend. In the former case, <function>GetNamedDSMSegment</function>
|
||||
passes the <literal>void *arg</literal> argument to the
|
||||
<function>init_callback</function>. This is particularly useful for
|
||||
reusing an initialization callback function for multiple DSM segments.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user