Files
RustPython/extra_tests/snippets/builtin_posixshmem.py
8443b2c97e Add POSIX shared memory module for multiprocessing on Unix (#6498)
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-25 14:54:44 +09:00

13 lines
238 B
Python

import os
import sys
if os.name != "posix":
sys.exit(0)
import _posixshmem
name = f"/rp_posixshmem_{os.getpid()}"
fd = _posixshmem.shm_open(name, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0o600)
os.close(fd)
_posixshmem.shm_unlink(name)