Arrays in shared memory
Manages a shared memory object as an array,
including the representation of arbitrary O'Caml values.
The first argument of type 'a
is the default value of the
array elements.
This bases on Netshm.manage
, and the arguments pagesize
,
locking_method
and shm_descr
are documented there.
If an empty memory object is managed, it is initialized as array with zero elements. If a non-empty memory object is managed, it must contain a valid array structure. The size of the array is then the same as when the array was managed the last time.
By passing init
with argument n
, the array is reinitialized as
array with n
elements containing the default value.
It is essential that the same data managers are passed as at the time when the array was initialized.
Arrays are implemented as (int32, 'a) Netshm_hashtbl.t
.
get a k
: Returns the contents of the array element number k
where
0 <= k < length a
.
If you do module Array = Netshm_array
in your code you can also
use the notation a.(k)
.
set a k x
: Sets the contents of the array element number k
to x
where 0 <= k < length a
.
If you do module Array = Netshm_array
in your code you can also
use the notation a.(k) <- x
.