Server.withLiveState
As liveState , scoped to block : opens the live view, runs block against it, and cancels the background pump before returning — the same withServer / withControl shape, for the one resource liveState itself cannot close on its own.
Source and package
- Module
- io.github.libtmux.kotlin
- Declared in
- Server
- Package
- io.github.libtmux:libtmux-kotlin
- Source
- libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/LiveState.kt
- public Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation fun <R> Server
.with ( session: Session, attachTimeout: Duration = config.defaultLive State Timeout ().toKotlin (), block: Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation (StateDuration Flow <ServerMirror >) -> R, ): R.View -
Description#
liveState's pump runs untilscopeends, by design (a caller collecting it for the life of a program passes its own long-lived scope) — which means a barecoroutineScope { liveState(...) }never returns:coroutineScopewaits for every child, the pump included, and nothing inside it asks the pump to stop. This cancels that one child explicitly onceblockis done, whether it returns or throws.- Parameters
-
-
session ( Session )
-
attachTimeout ( Duration )
-
block ( Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation )
-
Discussed in Getting started