Created
July 12, 2016 01:13
-
-
Save mathhun/4c76441b101e1b2c67848ac9cced140e to your computer and use it in GitHub Desktop.
FutureAwait.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration.Duration | |
import scala.sys.process._ | |
object Main extends App { | |
"date +start:%H:%M:%S".! | |
val fx = Future { println(1); Thread.sleep(6000); "date +x%H:%M:%S".!; 1 } | |
val fy = Future { println(2); Thread.sleep(4000); "date +y%H:%M:%S".!; 2 } | |
Await.result(fx, Duration.Inf) | |
Await.result(fy, Duration.Inf) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment