Cancelable

zio.blocks.async.Cancelable
See theCancelable companion object
trait Cancelable extends AutoCloseable

Handle returned by Async.start (via Async.Running) that stops a running Async.

Calling cancel() is idempotent and synchronous. It prevents a terminal value from being published if cancellation linearizes before the run reaches completion, and it is a no-op once the run has completed.

When cancellation wins, the driver also signals Pollable.cancel on the active pending operation. A source that can abort an in-flight socket read, timer, or callback registration implements that hook; the default hook is a no-op. Cancellation does not wait for an already-running Pollable.poll invocation to return.

Extends java.lang.AutoCloseable so a Async.Running handle can be used as a managed resource (scala.util.Using, Java try-with-resources): close simply delegates to cancel(). cancel remains the canonical verb — it names the domain operation (stop an in-flight computation) and, unlike AutoCloseable.close, declares no checked exception.

Attributes

Companion
object
Source
Cancelable.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Running[A]
class AsyncSelector[A]

Members list

Value members

Abstract methods

def cancel(): Unit

Stop the driver loop. Idempotent and synchronous; a no-op after the run has completed. See the trait documentation for the cancellation contract.

Stop the driver loop. Idempotent and synchronous; a no-op after the run has completed. See the trait documentation for the cancellation contract.

Attributes

Source
Cancelable.scala

Concrete methods

final def close(): Unit

Alias for cancel() so a running handle works as an AutoCloseable.

Alias for cancel() so a running handle works as an AutoCloseable.

Attributes

Source
Cancelable.scala