scala.concurrent.stm.skel

Type members

Classlikes

abstract class AtomicArray[T] extends IndexedSeq[T] with IndexedSeqOps[T, [T] =>> AtomicArray[T], AtomicArray[T]] with IterableFactoryDefaults[T, [T] =>> AtomicArray[T]]

AtomicArray implements a fixed-length indexed sequence where reads and writes have volatile semantics. In addition, it adds an atomic swap operation (swap) and an atomic compare-and-swap (compareAndSet). The collection is backed by one of the Java atomic array classes, with the best match chosen at construction time using a manifest.

AtomicArray implements a fixed-length indexed sequence where reads and writes have volatile semantics. In addition, it adds an atomic swap operation (swap) and an atomic compare-and-swap (compareAndSet). The collection is backed by one of the Java atomic array classes, with the best match chosen at construction time using a manifest.

Instances of AtomicArray[T] are backed by AtomicIntegerArray if T is a primitive of at most 32 bits (smaller values are padded rather than packed). AtomicArray[Long] and AtomicArray[Double] are backed by AtomicLongArray. All other instances of AtomicArray[T] are backed by AtomicReferenceArray (except for AtomicArray[Unit]). Floats and doubles are stored using their raw bit representation.

This class is used in the implementation of the reference STM implementation, but it is standalone and may be generally useful.

Authors

Nathan Bronson

Companion
object
object AtomicArray extends StrictOptimizedClassTagSeqFactory[[T] =>> AtomicArray[T]]
Companion
class
trait AtomicArrayBuilder[A] extends Builder[A, AtomicArray[A]]
Companion
object
Companion
class
object SimpleRandom

A random number generator that focuses on speed and lack of inter-thread interference, rather than on the quality of the numbers returned. The object SimpleRandom is striped internally to reduce contention when accessed from multiple threads. The class SimpleRandom should only be used by a single thread.

A random number generator that focuses on speed and lack of inter-thread interference, rather than on the quality of the numbers returned. The object SimpleRandom is striped internally to reduce contention when accessed from multiple threads. The class SimpleRandom should only be used by a single thread.

The constants in this 64-bit linear congruential random number generator are from http://nuclear.llnl.gov/CNP/rng/rngman/node4.html.

Authors

Nathan Bronson

Companion
class

An clonable unsynchronized random number generator that uses the same algorithm as the concurrent object SimpleRandom. The caller must ensure that each SimpleRandom instance is used from only one thread at a time.

An clonable unsynchronized random number generator that uses the same algorithm as the concurrent object SimpleRandom. The caller must ensure that each SimpleRandom instance is used from only one thread at a time.

Authors

Nathan Bronson

Companion
object
class StubInTxn extends InTxn
class StubSTMImpl extends STMImpl