crow/col/shared-array.crow
(source)
shared-array
[t
] record
shared
(has non-public fields)
Shared equivalent to 'mut-array'.
Iteration is not supported; since operations on this take a lock, they need to be short.
If you need to iterate, you could use 'copy-to' or 'move-to' to get a snapshot of all the elements
and iterate it at your leisure.
new
[t
] t
shared-array
(...
a
t
array
)
size
[t
] nat64
(a
t
shared-array
)
is-empty
[t
] bool
(a
t
shared-array
)
copy-to
[t
] t
array
(a
t
shared-array
) unsafe
WARN: This holds the lock while copying the entire array. Consider using 'move-to' instead.