Shared mutable variables
The marshallable descriptor of a reference
assign sr x
: Sets the contents of sr
to a deep copy of x
.
While performing the assignment the heap is write-locked,
and no other assign
can run.
Dereferences the variable and returns the contents, comparable to
!
. Note that this returns a value that lives in shared memory,
and there is no guarantee that this value still exists if
assign
operations are done in parallel, and old version are
garbage-collected. If such values are accessed the program may
crash!
deref_p sr f
: Runs f
with the contents of sr
, and returns
the result of f
. While f
is being executed, the current contents
are specially protected so that they cannot be garbage collected,
even if a parallel assign
changes the current value of the
variable. (Suffix "_p" = pinning version.)
deref_c sr
: Returns a copy of the contents of sr
. The copy is
created in normal memory. (Suffix "_c" = copying version.)
Look up the reference for this descriptor