diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-12-09 10:51:06 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-12-09 10:51:06 +0000 |
commit | d6cca14c48db02f2b3e868e850b7be91da2ca3da (patch) | |
tree | 9a5f9bb30bc99c25051465bf70009587f606114e /test/pending/jvm/t2515.scala | |
parent | 24ad61eb2d060880384f81825422ef3dda1bccf7 (diff) | |
download | scala-d6cca14c48db02f2b3e868e850b7be91da2ca3da.tar.gz scala-d6cca14c48db02f2b3e868e850b7be91da2ca3da.tar.bz2 scala-d6cca14c48db02f2b3e868e850b7be91da2ca3da.zip |
moved t2515 to pending (fails on ibm6). no review
Diffstat (limited to 'test/pending/jvm/t2515.scala')
-rw-r--r-- | test/pending/jvm/t2515.scala | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/pending/jvm/t2515.scala b/test/pending/jvm/t2515.scala new file mode 100644 index 0000000000..ee655967f3 --- /dev/null +++ b/test/pending/jvm/t2515.scala @@ -0,0 +1,43 @@ +import scala.actors.{Futures, TIMEOUT} +import scala.actors.Actor._ + +object Test { + + def compute(): Option[Boolean] = { + val fts = for (j <- 0 until 5) yield Futures.future { + receiveWithin (100) { + case TIMEOUT => true + case other => false + } + } + val done = Futures.awaitAll(2000, fts.toArray: _*) // list to array, as varargs + if (done.contains(None)) + None + else + Some(true) + } + + def main(args:Array[String]) : Unit = { + val ft = Futures.future { + val format = new java.text.DecimalFormat("000.00'ms'") + var iter = 1 + val done = 11 + while (iter < done) { + val start = System.nanoTime() + val result = compute() + val time = System.nanoTime() - start + result match { + case Some(result) => + //printf("Iteration %2d succeeded after %s %n", iter, format.format(time / 1e6)) + printf("Iteration %2d succeeded%n", iter) + iter += 1 + case None => + printf(">>>> Iteration %2d failed after %s <<<<< %n", iter, format.format(time / 1e6)) + iter = done + } + } + } + ft() + } + +} |