Skip to content

Instantly share code, notes, and snippets.

@adamw
Last active June 7, 2019 11:18
Show Gist options
  • Save adamw/692eceeea4755a0433e637d1057190e8 to your computer and use it in GitHub Desktop.
Save adamw/692eceeea4755a0433e637d1057190e8 to your computer and use it in GitHub Desktop.
val a = IO.effectAsync[Any, Nothing, Unit] { cb =>
ec3.submit(new Runnable {
override def run(): Unit = {
println(Thread.currentThread().getName + " (async)")
cb(UIO.unit)
}
})
}
run("async") {
printThread *> a *> printThread
}
/*
Outputs:
-- async --
main
ec3-1-1627960023 (async)
zio-default-async-7-1702146597
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment