Lifetime

sealed class Lifetime

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun add(action: () -> Unit)
Link copied to clipboard
abstract fun attach(child: LifetimeDefinition, inheritTimeoutKind: Boolean)
Link copied to clipboard
fun <T : Any> bracket(opening: () -> T, terminationAction: () -> Unit): T?
Link copied to clipboard
abstract fun <T : Any> bracketIfAlive(opening: () -> T, terminationAction: () -> Unit): T?
Link copied to clipboard
abstract fun <T : Any> bracketIfAliveEx(opening: () -> T, terminationAction: (T) -> Unit): T?
Link copied to clipboard
abstract fun <T : Any> bracketOrThrow(opening: () -> T, terminationAction: () -> Unit): T
Link copied to clipboard
abstract fun <T : Any> bracketOrThrowEx(opening: () -> T, terminationAction: (T) -> Unit): T
Link copied to clipboard
fun createNested(): LifetimeDefinition
fun createNested(atomicAction: (LifetimeDefinition) -> Unit): LifetimeDefinition
Link copied to clipboard
fun createNestedDef(): LifetimeDefinition
Link copied to clipboard
abstract fun <T : Any> executeIfAlive(action: () -> T): T?
Link copied to clipboard
abstract fun <T : Any> executeOrThrow(action: () -> T): T
Link copied to clipboard
fun <T : Any> ifAlive(action: () -> T): T?
Link copied to clipboard
abstract fun onTermination(closeable: Closeable)
abstract fun onTermination(action: () -> Unit)
Link copied to clipboard
abstract fun onTerminationIfAlive(closeable: Closeable): Boolean
abstract fun onTerminationIfAlive(action: () -> Unit): Boolean
Link copied to clipboard
inline fun <T> usingNested(action: (Lifetime) -> T): T

Properties

Link copied to clipboard
abstract val allowTerminationUnderExecution: Boolean
Link copied to clipboard
abstract val coroutineScope: CoroutineScope
Link copied to clipboard
val isTerminated: Boolean
Link copied to clipboard
abstract val status: LifetimeStatus
Link copied to clipboard
abstract val terminationTimeoutKind: LifetimeTerminationTimeoutKind

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun Lifetime.assertAlive()
Link copied to clipboard
fun <T> Lifetime.async(    context: CoroutineContext = EmptyCoroutineContext,     start: CoroutineStart = CoroutineStart.DEFAULT,     block: suspend CoroutineScope.() -> T): Deferred<T>
fun <T> Lifetime.async(    scheduler: IScheduler,     start: CoroutineStart = CoroutineStart.DEFAULT,     block: suspend CoroutineScope.() -> T): Deferred<T>
Link copied to clipboard
fun Lifetime.createTerminatedAfter(duration: Duration, terminationContext: CoroutineContext): Lifetime
Link copied to clipboard
fun Lifetime.defineIntersection(lifetime: Lifetime): LifetimeDefinition
Link copied to clipboard
fun Lifetime.intersect(lifetime: Lifetime): Lifetime

Creates an intersection of some lifetimes: new lifetime that terminate when either one terminates. Created lifetime inherits the smallest terminationTimeoutKind

Link copied to clipboard
val Lifetime.isAlive: Boolean
Link copied to clipboard
val Lifetime.isEternal: Boolean
Link copied to clipboard
val Lifetime.isNotAlive: Boolean
Link copied to clipboard
fun Lifetime.launch(    context: CoroutineContext = EmptyCoroutineContext,     start: CoroutineStart = CoroutineStart.DEFAULT,     block: suspend CoroutineScope.() -> Unit): Job
fun Lifetime.launch(    scheduler: IScheduler,     start: CoroutineStart = CoroutineStart.DEFAULT,     block: suspend CoroutineScope.() -> Unit): Job
Link copied to clipboard
fun Lifetime.onTermination(action: () -> Unit)
fun Lifetime.onTermination(closeable: Closeable)
Link copied to clipboard
operator fun Lifetime.plusAssign(action: () -> Unit)
Link copied to clipboard
fun Lifetime.throwIfNotAlive()
Link copied to clipboard
inline fun <T> Lifetime.view(viewable: IViewable<T>, crossinline handler: Lifetime.(T) -> Unit)
Link copied to clipboard
inline fun <T : Any> Lifetime.viewNotNull(viewable: IViewable<T?>, crossinline handler: Lifetime.(T) -> Unit)
Link copied to clipboard
fun Lifetime.waitTermination()