Shared 2-dimensional arrays (matrices)
Arrays where the elements have type 'e
and the header has
type 'h
The marshallable descriptor of a shared matrix
init pool_id n1 n2 f h
:
Creates a matrix of the passed number of elements (n1 * n2),
and for getting the element at position k
the function
f k
is run, and the copy of the result is written to the
position. The header is set to the copy of h
.
set sa k1 k2 x
: Sets the (k1,k2)-th
element of the matrix sa
to a
deep copy of x
.
get_ro sa k1 k2
: Gets the (k1,k2)
-th element of the matrix sa
.
Note that there is no guarantee that this value still exists if
it is returned, and a parallely running set
changes this element.
If such values are accessed the program may crash!
get_p sa k1 k2 f
: Gets the (k1,k2)
-th element of the matrix sa
and call f
with this element, and returns the result of f
.
During the execution of f
the requested element cannot be
garbage collected.
get_c sa k1 k2
: Gets a copy of the (k1,k2)
-th element of the matrix
sæ
Returns the raw array in shared memory for unprotected access
Look up the matrix for this descriptor