-
-
Save retronym/1e495c48dbf04967c6c4 to your computer and use it in GitHub Desktop.
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
scala> object Test { | |
| def main(args: Array[String]): Unit = { | |
| import scala.concurrent._ | |
| import ExecutionContext.Implicits.global | |
| val source1 = Promise[Int]() | |
| val source2 = Promise[Int]() | |
| | |
| val done = Promise[Boolean]() | |
| val future2 = source2.completeWith(source1.future).future | |
| future2.onComplete { | |
| case _ => done.success(true) | |
| } | |
| source2.tryFailure(new TimeoutException) | |
| source1.success(123) | |
| import duration._ | |
| assert(Await.result(done.future, 10.minutes)) | |
| } | |
| } | |
defined object Test | |
scala> | |
scala> (1 to 1000) foreach {i => print("."); Test.main(null)} | |
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ | |
scala> (1 to 1000) foreach {i => print("."); Test.main(null)} | |
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment