From 344ac60c3f34cc0a1c6e6aae1479878fe63476eb Mon Sep 17 00:00:00 2001 From: Aleksandar Prokopec Date: Mon, 28 Oct 2013 11:20:23 +0100 Subject: SI-7938 - parallel collections should use default ExecutionContext Parallel collections now use `scala.concurrent.ExecutionContext` by default. The `ExecutionContextTaskSupport` is optimized to use the `ForkJoinPool` underlying the `ExecutionContext` if possible. Otherwise, a fallback `TaskSupport` that creates a reduction tree and execute an operation through `Future`s is used. --- test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala') diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala index 255c04498e..691a3e961e 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala @@ -24,6 +24,8 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa def hasStrictOrder = true + def tasksupport: TaskSupport + def ofSize(vals: Seq[Gen[T]], sz: Int) = { val a = new mutable.ArrayBuffer[T](sz) val gen = vals(rnd.nextInt(vals.size)) @@ -33,6 +35,7 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa def fromSeq(a: Seq[T]) = { val pa = new ParArray[T](a.size) + pa.tasksupport = tasksupport var i = 0 for (elem <- a.toList) { pa(i) = elem @@ -50,7 +53,7 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa } -object IntParallelArrayCheck extends ParallelArrayCheck[Int]("Int") with IntSeqOperators with IntValues { +class IntParallelArrayCheck(val tasksupport: TaskSupport) extends ParallelArrayCheck[Int]("Int") with IntSeqOperators with IntValues { override def instances(vals: Seq[Gen[Int]]) = oneOf(super.instances(vals), sized { sz => (0 until sz).toArray.toSeq }, sized { sz => -- cgit v1.2.3