Shmex v0.1.0 Shmex View Source
This module allows using payload placed in POSIX shared memory on POSIX compliant systems.
Defines a struct representing the actual shared memory object. The struct
should not be modified, and should always be passed around as a whole - see
Shmex.t/0
Link to this section Summary
Types
Struct describing payload kept in shared memory. Should not be modified and should always be passed around as a whole
Functions
Creates a new, empty Shm payload with the given capacity
Creates a new Shm payload from existing data
Creates a new Shm payload initialized with data
and set capacity
Sets the capacity of SHM
Link to this section Types
t() :: %Shmex{ capacity: pos_integer(), guard: reference(), name: binary(), size: non_neg_integer() }
Struct describing payload kept in shared memory. Should not be modified and should always be passed around as a whole
…including passing to the native code - there are functions in :shmex_lib
(a native library exported via Bundlex) that will allow to transorm Elixir
struct into a C struct and then access the shared memory from the native code.)
Shared memory should be available as long as the associated struct is not garbage collected.
Link to this section Functions
Creates a new, empty Shm payload with the given capacity
Creates a new Shm payload from existing data.
new(data :: binary(), capacity :: pos_integer()) :: t()
Creates a new Shm payload initialized with data
and set capacity.
The actual capacity is the greater of passed capacity and data size
set_capacity(t(), pos_integer()) :: t()
Sets the capacity of SHM.
If the capacity is smaller than the current size, data will be discarded and size modified