Skip to content

Instantly share code, notes, and snippets.

@heiner
heiner / shm.py
Last active June 20, 2022 16:06 — forked from jakirkham/shm.py
Some Python ctypes-based POSIX shared memory functions
import os
import sys
try:
from _posixshmem import shm_open, shm_unlink
except ImportError:
import ctypes
dllname = None
if sys.platform.startswith("linux"):
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15|
----------------------------------------------|
0 0 0 0 | 0
1 1 1 1 | 0
2 2 2 2 | 1
3 3 3 3 | 1
4 4 4 4 | 2
5 5 5 5 | 2
6 6 6 6 | 3
7 7 7 7| 3