Skip to content

Commit 620da83

Browse files
committed
Update document
1 parent 416c6d8 commit 620da83

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

Doc/library/multiprocessing.shared_memory.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,24 @@ copying of data.
119119

120120
*flags* (0 by default) takes :ref:`bitwise ORed <bitwise>` flags together.
121121

122-
* :data:`!os.SHM_RENAME_EXCHANGE` will let
123-
an exchange with *newname* will be processed instead.
124-
* :data:`!os.SHM_RENAME_NOREPLACE` will raise
125-
an error will be triggered if *newname* already exists.
122+
.. availability:: FreeBSD >= 13.0
126123

124+
.. versionadded:: next
125+
126+
.. data:: SHM_RENAME_EXCHANGE
127+
SHM_RENAME_NOREPLACE
128+
129+
Parameters to the :func:`rename` function.
130+
131+
:const:`SHM_RENAME_EXCHANGE`
132+
Atomically exchange the SharedMemory to the *newname*.
133+
134+
:const:`SHM_RENAME_NOREPLACE`
135+
Raise an error if *newname* exists, rather than unlinking it.
136+
137+
.. availability:: FreeBSD >= 13.0
138+
139+
.. versionadded:: next
127140

128141
.. attribute:: buf
129142

Lib/multiprocessing/shared_memory.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ def unlink(self):
255255
resource_tracker.unregister(self._name, "shared_memory")
256256

257257
if _USE_POSIX and hasattr(_posixshmem, "shm_rename"):
258+
from _posixshmem import SHM_RENAME_EXCHANGE
259+
from _posixshmem import SHM_RENAME_NOREPLACE
260+
258261
def rename(self, newname, flags=0):
259262
"""Renames a shared memory block.
260263

0 commit comments

Comments
 (0)