Skip to content

FMjShmHeader

Cross-platform shared-memory region for the URLab SHM transport: a

fixed-size, file-backed mmap region with a header and N buffer slots. Producers double-buffer (n_buffers=2) and bump a sequence counter after each write; consumers poll the sequence to detect new data. The implementation calls into the platform's mmap directly (::MapViewOfFile on Windows, ::mmap on Linux/macOS). UE's IMappedFileHandle is read-only, which doesn't fit our writer use case, so this lower-level wrapper is justified. Both branches keep the surface tiny (Open / Close / GetData / GetSize) so the publisher logic above stays portable. / / Magic number identifying a URLab SHM region. ASCII "URLB" little-endian. */ inline constexpr uint32 URLAB_SHM_MAGIC = 0x42'4C'52'55; inline constexpr uint32 URLAB_SHM_PROTOCOL_VERSION = 1; / Fixed header layout. Must be exactly 64 bytes (one cache line) for atomic alignment safety and to make the C side and Python side trivially agree. Layout (offsets in bytes): 0 uint32 magic 4 uint32 protocol_version 8 uint32 buffer_stride 12 uint32 n_buffers 16 atomic sequence 24 atomic latest_idx 28 uint8[36] reserved Atomic alignment notes: - sequence at offset 16 -> 8-byte aligned. Good. - latest_idx at offset 24 -> 4-byte aligned. Good. - All atomics are over primitive integer types, ABI-stable across the major x86_64 / arm64 compilers we target.

Attribute Value
Kind Struct

Properties

Public Properties

Property Type Description
Magic uint32
ProtocolVersion uint32
BufferStride uint32
NBuffers uint32

Magic

  • Type: uint32

ProtocolVersion

  • Type: uint32

BufferStride

  • Type: uint32

NBuffers

  • Type: uint32