Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. val a = IO.effectAsync[Any, Nothing, Unit] { cb =>
  2. ec3.submit(new Runnable {
  3. override def run(): Unit = {
  4. println(Thread.currentThread().getName + " (async)")
  5. cb(UIO.unit)
  6. }
  7. })
  8. }
  9.  
  10. run("async") {
  11. printThread *> a *> printThread
  12. }
  13.  
  14. /*
  15. Outputs:
  16.  
  17. -- async --
  18. main
  19. ec3-1-1627960023 (async)
  20. zio-default-async-7-1702146597
  21. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement