Performs a transactional read of the index
th element of this
transactional array.
Performs a transactional read of the index
th element of this
transactional array. Equivalent to refs(index).get
.
Returns a string representation of the transactional value in this instance for debugging convenience.
Returns a string representation of the transactional value in this
instance for debugging convenience. The Ref
reads (and writes)
performed while constructing the result will be discarded before
returning. This method works fine outside a transaction.
If this method is called from within a transaction that is already
doomed (status Txn.Rolledback
), a string describing the reason
for the outer transaction's rollback will be returned.
Returns some value that is suitable for examination in a debugger,
or returns a Txn.RollbackCause
if called from inside a doomed atomic
block.
Returns some value that is suitable for examination in a debugger,
or returns a Txn.RollbackCause
if called from inside a doomed atomic
block.
Returns the length of this TArray
, which does not change.
Returns a sequence of Ref
instances that are backed by elements of this
TArray
.
Returns a sequence of Ref
instances that are backed by elements of this
TArray
. All operations on the contained Ref
s are supported.
As an example, the following code tests whether a(i)
is greater than
10 without requiring the transaction to roll back for all writes to
a(i)
:
atomic { implicit t => if (a.refs(i).getWith( _ > 10 )) { ... lots of stuff } }
Returns a TArray.View
that allows access to the contents of this
TArray
without requiring that an InTxn
be available.
Returns a TArray.View
that allows access to the contents of this
TArray
without requiring that an InTxn
be available. See Ref.View
.
Performs a transactional write to the index
th element of this
transactional array.
Performs a transactional write to the index
th element of this
transactional array. Equivalent to refs(index).set(v)
.
Bulk transactional storage, roughly equivalent to
Array[Ref[T]]
but potentially much more space efficient. Elements can be read and written directly, or therefs
method can be used to obtain transientRef
instances backed by the elements of theTArray
.