← All compilation units

Flyology_Cachelines.Padded

Description

Wraps a value in an independently spaced storage object.

Create

function Create (Value : Element_Type) return Padded

Wrap a value in padded storage.

Parameters
Value

The value to wrap.

Return value

A padded object containing Value.

Element_Type

type Element_Type is private;

Padded

type Padded is record
   Value : Element_Type;
end record;

A value isolated by the destructive-interference spacing policy.

Padded controls storage placement only. It does not make access to Value atomic, synchronized, or safe between tasks. Callers must use the same synchronization that Element_Type would otherwise require.

Every object starts on a destructive-interference boundary, and its object size is rounded up by GNAT to a whole number of such boundaries. Consequently, adjacent values in arrays cannot falsely share a boundary.

Record fields
Value

The wrapped value. Access requires the same synchronization as direct access to Element_Type.

Padded_Size_In_Storage_Elements

Padded_Size_In_Storage_Elements : constant Positive := Padded'Object_Size / System.Storage_Unit;

Object size of Padded in System.Storage_Unit elements.

Unwrap

function Unwrap (Item : Padded) return Element_Type

Extract the value from padded storage.

Parameters
Item

The padded object to read.

Return value

The contained value.