Package-level declarations
Kotlin/Native-specific concurrency primitives and utility functions for concurrent programming.
Kotlin/Native-specific concurrency primitives and utility functions for concurrent programming.
Kotlin/Native-specific concurrency primitives and utility functions for concurrent programming.
Kotlin/Native-specific concurrency primitives and utility functions for concurrent programming.
Types
An Int value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
A Long value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
A kotlinx.cinterop.NativePtr value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
An object reference that is always updated atomically.
Detached object graph encapsulates transferrable detached subgraph which cannot be accessed externally, until it is attached with the attach extension function.
This class was useful only with legacy memory manager. Please use AtomicReference instead.
Exception thrown whenever freezing is not possible.
Class representing abstract computation, whose result may become available in the future.
Exception thrown whenever we attempt to mutate frozen objects.
Mutable concurrently accessible data buffer. Could be accessed from several workers simultaneously.
Marks all Worker
-related API as obsolete.
Marks all Worker
-related API as obsolete.
Marks all Worker
-related API as obsolete.
This annotation has no effect, and its usages can be safely dropped.
This annotation has no effect, and its usages can be safely dropped.
Marks a top level property with a backing field or an object as thread local. The object remains mutable and it is possible to change its state, but every thread will have a distinct copy of this object, so changes in one thread are not reflected in another.
Marks a top level property with a backing field or an object as thread local. The object remains mutable and it is possible to change its state, but every thread will have a distinct copy of this object, so changes in one thread are not reflected in another.
Note: modern Kotlin/Native memory manager allows to share objects between threads without additional ceremonies, so TransferMode has effect only in legacy memory manager.
A shared reference to a Kotlin object that doesn't freeze the referred object when it gets frozen itself.
Properties
Functions
Atomic lazy initializer, could be used in frozen objects, freezes initializing lambda, so use very carefully. Also, as with other uses of an AtomicReference may potentially leak memory, so it is recommended to use atomicLazy
in cases of objects living forever, such as object singletons, or in cases where it's guaranteed not to have cyclical garbage.
Attaches previously detached object subgraph created by DetachedObjectGraph. Please note, that once object graph is attached, the DetachedObjectGraph.stable pointer does not make sense anymore, and shall be discarded, so attach of one DetachedObjectGraph object can only happen once.
This function ensures that if we see such an object during freezing attempt - freeze fails and FreezingException is thrown.
Wait for availability of futures in the collection. Returns set with all futures which have value available for the consumption, i.e. FutureState.COMPUTED.
Executes block with new Worker as resource, by starting the new worker, calling provided block (in current context) with newly started worker as this and terminating worker after the block completes. Note that this operation is pretty heavyweight, use preconfigured worker or worker pool if need to execute it frequently.