Core LibraryAPI Reference

Choose documentation 1

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

method libtmux-kotlin latest

Server.withLiveState

Package io.github.libtmux.kotlin.Server.withLiveState io.github.libtmux.kotlin

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.

View as Markdown

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.withLiveState( session: Session, attachTimeout: Duration = config.defaultTimeout().toKotlinDuration(), 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 (StateFlow<ServerMirror.View>) -> R, ): R
methodasync [source]

Description#

liveState 's pump runs until scope ends, by design (a caller collecting it for the life of a program passes its own long-lived scope) — which means a bare coroutineScope { liveState(...) } never returns: coroutineScope waits for every child, the pump included, and nothing inside it asks the pump to stop. This cancels that one child explicitly once block is 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

Esc

Type to search.