asyncRuntimeAwait

zio.blocks.async.internal.AsyncRuntimeAwait$package.asyncRuntimeAwait
object asyncRuntimeAwait extends CpsRuntimeAwait[Async]

JVM-only runtime-await fallback for DCA.

The DCA macro rewrites .block into flatMap/map chains for all positions it understands (sequential, if, while, try/catch, match, and higher-order calls that have an AsyncShift). For the residual cases it cannot rewrite — e.g. an .block inside a plain user lambda with no shift — it falls back to this instance, which drives the Async to its value by blocking the calling thread (Loom-friendly, via the same parker as Async.block).

There is deliberately no equivalent on JS: a non-rewritable .block there is a compile error, since JavaScript cannot block.

This is not a cps.CpsRuntimeAsyncAwait — providing only the plain CpsRuntimeAwait keeps the macro rewrite as the primary path and uses blocking strictly as a last resort.

Attributes

Source
AsyncRuntimeAwait.scala
Graph
Supertypes
trait CpsRuntimeAwait[Async]
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def await[A](fa: encoding.Async[A])(ctx: CpsTryMonadContext[Async]): A

Attributes

Source
AsyncRuntimeAwait.scala