Core LibraryAPI Reference

Choose documentation 3

latest

Current version

latest
English

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

method libtmux-java latest

EventSubscription.onReady

Package io.github.libtmux.control.EventSubscription.onReady io.github.libtmux.control

Arms a one-shot wakeup for when this subscription has something to read, or has ended.

View as Markdown

Source and package
Module
io.github.libtmux.control
Declared in
EventSubscription
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/control/EventSubscription.java
onReady ( callback : Runnable ) → void
method [source]

Description#

Runs callback at once, on this thread, when a step is already waiting or the subscription has ended. Otherwise it runs once, on the control client's reader thread, when the first step arrives or the subscription ends, and is then disarmed: drain with #poll() until it is empty, then arm again. Checking and arming happen under the lock that delivery takes, so a step cannot slip between them unannounced.

The callback runs on the thread delivering events, so it must not block: resume a waiting coroutine, complete a promise, and return. One that throws is logged and ignored, and delivery continues.

Raises
  • IllegalStateException – if a callback is already armed, or a stream or publisher owns this subscription

Discussed in Getting started

Esc

Type to search.