EventSubscription.onReady
Arms a one-shot wakeup for when this subscription has something to read, or has ended.
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
-
Description#
Runs
callbackat 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
-
-
Illegal
State – if a callback is already armed, or a stream or publisher owns this subscriptionException
-
Discussed in Getting started