Package-level declarations

Types

Link copied to clipboard
class AtomicInt(var value: Int)

Wrapper around Int with atomic synchronized operations.

Since Kotlin 1.3
Link copied to clipboard
class AtomicLong(var value: Long = 0)

Wrapper around Long with atomic synchronized operations.

Since Kotlin 1.3
Link copied to clipboard
class AtomicNativePtr(var value: NativePtr)

Wrapper around kotlinx.cinterop.NativePtr with atomic synchronized operations.

Since Kotlin 1.3
Link copied to clipboard

Wrapper around Kotlin object with atomic operations.

Since Kotlin 1.3
Link copied to clipboard
class Continuation0(block: () -> Unit, invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>, singleShot: Boolean = false) : Function0<Unit>
Since Kotlin 1.3
Link copied to clipboard
class Continuation1<T1>(block: (p1: T1) -> Unit, invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>, singleShot: Boolean = false) : Function1<T1, Unit>
Since Kotlin 1.3
Link copied to clipboard
class Continuation2<T1, T2>(block: (p1: T1, p2: T2) -> Unit, invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>, singleShot: Boolean = false) : Function2<T1, T2, Unit>
Since Kotlin 1.3
Link copied to clipboard

Detached object graph encapsulates transferrable detached subgraph which cannot be accessed externally, until it is attached with the attach extension function.

Since Kotlin 1.3
Link copied to clipboard
class FreezableAtomicReference<T>(value_: T)

Note: this class is useful only with legacy memory manager. Please use AtomicReference instead.

Since Kotlin 1.3
Link copied to clipboard
class FreezingException(toFreeze: Any, blocker: Any) : RuntimeException

Exception thrown whenever freezing is not possible.

Since Kotlin 1.3
Link copied to clipboard
value class Future<T>

Class representing abstract computation, whose result may become available in the future.

Since Kotlin 1.3
Link copied to clipboard

State of the future object.

Since Kotlin 1.3
Link copied to clipboard

Exception thrown whenever we attempt to mutate frozen objects.

Since Kotlin 1.3
Link copied to clipboard
class MutableData(capacity: Int = 16)

Mutable concurrently accessible data buffer. Could be accessed from several workers simultaneously.

Since Kotlin 1.3
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.PROPERTY])
expect annotation class SharedImmutable

Note: this annotation has effect only in Kotlin/Native with legacy memory manager.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.PROPERTY])
actual annotation class SharedImmutable

Note: this annotation has effect only in Kotlin/Native with legacy memory manager.

Since Kotlin 1.3
Link copied to clipboard
expect annotation class ThreadLocal

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.

Since Kotlin 1.0
actual annotation class ThreadLocal

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.

Since Kotlin 1.3
Link copied to clipboard

Note: modern Kotlin/Native memory manager allows to share objects between threads without additional ceremonies, so TransferMode has effect only in legacy memory manager.

Since Kotlin 1.3
Link copied to clipboard
value class Worker

Class representing worker.

Since Kotlin 1.3
Link copied to clipboard
class WorkerBoundReference<out T : Any>(value: T)

A shared reference to a Kotlin object that doesn't freeze the referred object when it gets frozen itself.

Since Kotlin 1.3

Properties

Link copied to clipboard

Checks if given object is null or frozen or permanent (i.e. instantiated at compile-time).

Since Kotlin 1.3

Functions

Link copied to clipboard
fun <T> atomicLazy(initializer: () -> T): Lazy<T>

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.

Since Kotlin 1.3
Link copied to clipboard
inline fun <T> DetachedObjectGraph<T>.attach(): T

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.

Since Kotlin 1.3
Link copied to clipboard
Since Kotlin 1.3
Link copied to clipboard
Since Kotlin 1.3
Link copied to clipboard
Since Kotlin 1.3
Link copied to clipboard
external fun Any.ensureNeverFrozen()

This function ensures that if we see such an object during freezing attempt - freeze fails and FreezingException is thrown.

Since Kotlin 1.3
Link copied to clipboard
fun <T> T.freeze(): T

Freezes object subgraph reachable from this object. Frozen objects can be freely shared between threads/workers.

Since Kotlin 1.3
Link copied to clipboard
fun <T> waitForMultipleFutures(futures: Collection<Future<T>>, timeoutMillis: Int): Set<Future<T>>

Wait for availability of futures in the collection. Returns set with all futures which have value available for the consumption, i.e. FutureState.COMPUTED.

Since Kotlin 1.3
Link copied to clipboard
Since Kotlin 1.3
Link copied to clipboard
external fun waitWorkerTermination(worker: Worker)
Since Kotlin 1.3
Link copied to clipboard
inline fun <R> withWorker(name: String? = null, errorReporting: Boolean = true, block: Worker.() -> R): R

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.

Since Kotlin 1.3