KetraTerm
API · DevelopmentAll versions

withMutationAdmission

fun <T> withMutationAdmission(isCurrent: () -> Boolean, action: () -> T): T?

Runs captured host work only if its owner is still current at mutation admission. This synchronous boundary can wait for graphics decoding; call it off UI threads. Nested session setters share the admission. Frame reads and input do not wait for this gate. The callbacks must be prompt, must not access UI state, and must never wait for UI work or close the session.

Return

the action result, or null when closed or no longer current.

Parameters

isCurrent

thread-safe validity check evaluated after acquiring admission.

action

captured host mutations executed in order when still current.

Throws

on output reentry or callback reentry that would invert lock order.