diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2013-10-28 11:20:23 +0100 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2013-10-29 12:15:10 +0100 |
commit | 344ac60c3f34cc0a1c6e6aae1479878fe63476eb (patch) | |
tree | 97e5de64b81b5cb76913e8773171a1ad93b43244 /test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala | |
parent | 1819af77fd4ecc66c89a84ea321aa7d6f92285ec (diff) | |
download | scala-344ac60c3f34cc0a1c6e6aae1479878fe63476eb.tar.gz scala-344ac60c3f34cc0a1c6e6aae1479878fe63476eb.tar.bz2 scala-344ac60c3f34cc0a1c6e6aae1479878fe63476eb.zip |
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.
Diffstat (limited to 'test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala')
-rw-r--r-- | test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala | 5 |
1 files changed, 4 insertions, 1 deletions
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 => |