pynbody.array.shared.posix_detail

pynbody.array.shared.posix_detail#

POSIX-specific shared memory implementation.

Uses Python’s internal _posixshmem module instead of ctypes calling libc directly. This is necessary because on macOS, ctypes has issues with shm_open permission handling that cause “Permission denied” errors when opening existing shared memory segments. The reason for this is unclear. However, the _posixshmem module (used internally by multiprocessing.shared_memory) handles the system calls correctly on all POSIX platforms.

Functions

cleanup_all_shared_memory()

Clean up all POSIX shared memory segments - handled by individual unlinks

create_shared_memory(name, size)

Create POSIX shared memory segment using _posixshmem module.

get_shared_memory_info(name)

Get information about a shared memory segment - not needed for POSIX

open_shared_memory(name[, size])

Open existing POSIX shared memory segment using _posixshmem module.

reconstruct_shared_memory(name, dims, dtype)

Reconstruct shared memory for cross-process sharing

unlink_shared_memory(name)

Unlink POSIX shared memory segment using _posixshmem module.