An atomic reference to a frozen Kotlin object. Can be used in concurrent scenarious but frequently shall be of nullable type and be zeroed out (with
compareAndSwap(get(), null)) once no longer needed. Otherwise memory leak could happen.
class Continuation0 : () -> Unit
class Continuation1<T1> : (T1) -> Unit
class Continuation2<T1, T2> : (T1, T2) -> Unit
Detached object graph encapsulates transferrable detached subgraph which cannot be accessed externally, until it is attached with the attach extension function.
An atomic reference to a Kotlin object. Can be used in concurrent scenarious, but must be frozen first, otherwise behaves as regular box for the value.
Exception thrown whenever freezing is not possible.
class FreezingException : RuntimeException
Class representing abstract computation, whose result may become available in the future.
State of the future object.
enum class FutureState
Exception thrown whenever we attempt to mutate frozen objects.
class InvalidMutabilityException : RuntimeException
Mutable concurrently accessible data buffer. Could be accessed from several workers simulteniously.
enum class TransferMode
Class representing worker.
Marks a top level variable with a backing field or an object as immutable. It is possible to share such object between multiple threads, but it becomes deeply frozen, so no changes can be made to its state or the state of objects it refers to.
annotation class SharedImmutable
Marks a top level variable 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.
annotation class ThreadLocal
Checks if given object is null or frozen or permanent (i.e. instantiated at compile-time).
val Any?.isFrozen: Boolean
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 signletons, or in cases where it's guaranteed not to have cyclical garbage.
fun <T> atomicLazy(initializer: () -> T): Lazy<T>
Attaches previously detached object subgraph created by DetachedObjectGraph. Please note, that once object graph is attached, the DetachedObjectGraph.stable pointer does not have sense anymore, and shall be discarded.
fun <T> DetachedObjectGraph<T>.attach(): T
fun <T1> COpaquePointer.callContinuation1()
fun <T1, T2> COpaquePointer.callContinuation2()
This function ensures that if we see such an object during freezing attempt - freeze fails and FreezingException is thrown.
Freezes object subgraph reachable from this object. Frozen objects can be freely shared between threads/workers.
fun <T> T.freeze(): T
fun <T> Collection<Future<T>>.waitForMultipleFutures( millis: Int ): Set<Future<T>>
© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.