1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-05 23:56:58 +03:00

"Pin", rather than "keep", dynamic shared memory mappings and segments.

Nobody seemed concerned about this naming when it originally went in,
but there's a pending patch that implements the opposite of
dsm_keep_mapping, and the term "unkeep" was judged unpalatable.
"unpin" has existing precedent in the PostgreSQL code base, and the
English language, so use this terminology instead.

Per discussion, back-patch to 9.4.
This commit is contained in:
Robert Haas 2014-10-30 11:35:55 -04:00
parent ae3eb9b8ef
commit 1c49dae165
4 changed files with 9 additions and 9 deletions

View File

@ -8,7 +8,7 @@
* facilities provided by dsm_impl.h and dsm_impl.c, mappings and segments * facilities provided by dsm_impl.h and dsm_impl.c, mappings and segments
* created using this module will be cleaned up automatically. Mappings * created using this module will be cleaned up automatically. Mappings
* will be removed when the resource owner under which they were created * will be removed when the resource owner under which they were created
* is cleaned up, unless dsm_keep_mapping() is used, in which case they * is cleaned up, unless dsm_pin_mapping() is used, in which case they
* have session lifespan. Segments will be removed when there are no * have session lifespan. Segments will be removed when there are no
* remaining mappings, or at postmaster shutdown in any case. After a * remaining mappings, or at postmaster shutdown in any case. After a
* hard postmaster crash, remaining segments will be removed, if they * hard postmaster crash, remaining segments will be removed, if they
@ -786,7 +786,7 @@ dsm_detach(dsm_segment *seg)
* only. * only.
*/ */
void void
dsm_keep_mapping(dsm_segment *seg) dsm_pin_mapping(dsm_segment *seg)
{ {
if (seg->resowner != NULL) if (seg->resowner != NULL)
{ {
@ -804,11 +804,11 @@ dsm_keep_mapping(dsm_segment *seg)
* *
* Note that this function does not arrange for the current process to * Note that this function does not arrange for the current process to
* keep the segment mapped indefinitely; if that behavior is desired, * keep the segment mapped indefinitely; if that behavior is desired,
* dsm_keep_mapping() should be used from each process that needs to * dsm_pin_mapping() should be used from each process that needs to
* retain the mapping. * retain the mapping.
*/ */
void void
dsm_keep_segment(dsm_segment *seg) dsm_pin_segment(dsm_segment *seg)
{ {
/* /*
* Bump reference count for this segment in shared memory. This will * Bump reference count for this segment in shared memory. This will
@ -819,7 +819,7 @@ dsm_keep_segment(dsm_segment *seg)
dsm_control->item[seg->control_slot].refcnt++; dsm_control->item[seg->control_slot].refcnt++;
LWLockRelease(DynamicSharedMemoryControlLock); LWLockRelease(DynamicSharedMemoryControlLock);
dsm_impl_keep_segment(seg->handle, seg->impl_private); dsm_impl_pin_segment(seg->handle, seg->impl_private);
} }
/* /*

View File

@ -996,7 +996,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
* do anything to receive the handle; Windows transfers it automatically. * do anything to receive the handle; Windows transfers it automatically.
*/ */
void void
dsm_impl_keep_segment(dsm_handle handle, void *impl_private) dsm_impl_pin_segment(dsm_handle handle, void *impl_private)
{ {
switch (dynamic_shared_memory_type) switch (dynamic_shared_memory_type)
{ {

View File

@ -36,8 +36,8 @@ extern void *dsm_remap(dsm_segment *seg);
extern void dsm_detach(dsm_segment *seg); extern void dsm_detach(dsm_segment *seg);
/* Resource management functions. */ /* Resource management functions. */
extern void dsm_keep_mapping(dsm_segment *seg); extern void dsm_pin_mapping(dsm_segment *seg);
extern void dsm_keep_segment(dsm_segment *seg); extern void dsm_pin_segment(dsm_segment *seg);
extern dsm_segment *dsm_find_mapping(dsm_handle h); extern dsm_segment *dsm_find_mapping(dsm_handle h);
/* Informational functions. */ /* Informational functions. */

View File

@ -73,6 +73,6 @@ extern bool dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size,
extern bool dsm_impl_can_resize(void); extern bool dsm_impl_can_resize(void);
/* Implementation-dependent actions required to keep segment until shudown. */ /* Implementation-dependent actions required to keep segment until shudown. */
extern void dsm_impl_keep_segment(dsm_handle handle, void *impl_private); extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private);
#endif /* DSM_IMPL_H */ #endif /* DSM_IMPL_H */