Skip to content

Instantly share code, notes, and snippets.

@ryoppy
Created December 10, 2014 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryoppy/f1927c5b8bf33e38c0f0 to your computer and use it in GitHub Desktop.
Save ryoppy/f1927c5b8bf33e38c0f0 to your computer and use it in GitHub Desktop.
並列で動いてない例
scala> def sleep = { Thread.sleep(2000); println("done"); 1 }
sleep: Int
scala> for { a <- Future(sleep); b <- Future(sleep) } yield { println(a + b) }
res19: scala.concurrent.Future[Unit] = scala.concurrent.impl.Promise$DefaultPromise@52621501
scala> done
done
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment