traveler.core.omx.SharedMemory#

class traveler.core.omx.SharedMemory(name=None, create=False, size=0, *, track=True)#

Bases: object

Creates a new shared memory block or attaches to an existing shared memory block.

Every shared memory block is assigned a unique name. This enables one process to create a shared memory block with a particular name so that a different process can attach to that same shared memory block using that same name.

As a resource for sharing data across processes, shared memory blocks may outlive the original process that created them. When one process no longer needs access to a shared memory block that might still be needed by other processes, the close() method should be called. When a shared memory block is no longer needed by any process, the unlink() method should be called to ensure proper cleanup.

Methods#

close()

Closes access to the shared memory from this instance but does not destroy the shared memory block.

unlink()

Requests that the underlying shared memory block be destroyed.

Attributes#

buf

A memoryview of contents of the shared memory block.

name

Unique name that identifies the shared memory block.

size

Size in bytes.