summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2013-10-28 11:20:23 +0100
committerAleksandar Prokopec <axel22@gmail.com>2013-10-29 12:15:10 +0100
commit344ac60c3f34cc0a1c6e6aae1479878fe63476eb (patch)
tree97e5de64b81b5cb76913e8773171a1ad93b43244 /test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala
parent1819af77fd4ecc66c89a84ea321aa7d6f92285ec (diff)
downloadscala-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/ParallelHashSetCheck.scala')
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala b/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala
index 8b41908a26..91de2472a7 100644
--- a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala
@@ -24,6 +24,8 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T]("
def hasStrictOrder = false
+ def tasksupport: TaskSupport
+
def ofSize(vals: Seq[Gen[T]], sz: Int) = {
val hm = new mutable.HashSet[T]
val gen = vals(rnd.nextInt(vals.size))
@@ -32,19 +34,20 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T]("
}
def fromTraversable(t: Traversable[T]) = {
- val phm = new ParHashSet[T]
+ val phs = new ParHashSet[T]
+ phs.tasksupport = tasksupport
var i = 0
for (kv <- t.toList) {
- phm += kv
+ phs += kv
i += 1
}
- phm
+ phs
}
}
-object IntParallelHashSetCheck extends ParallelHashSetCheck[Int]("Int")
+class IntParallelHashSetCheck(val tasksupport: TaskSupport) extends ParallelHashSetCheck[Int]("Int")
with IntOperators
with IntValues
{