summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/parallel/mutable/ParArray.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-12-09 10:08:11 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-12-09 10:08:11 +0000
commita730fb5cc6cea39a29e9ff4cd666fa8498f6adec (patch)
treea271e1b7cdd2bd044344fa7aef19d6820637b3a5 /src/library/scala/collection/parallel/mutable/ParArray.scala
parent4dbe72f83f7ade1517bad7444009d3d0c8a69bd5 (diff)
downloadscala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.tar.gz
scala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.tar.bz2
scala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.zip
Fixing jvm 1.5 support for parallel collections.
Special cased with thread pool executor scheduling. Fixed an ugly concurrency bug where futures returned by a thread pool executor didn't remove the task from the queue when cancel was called. Note to self and others: don't cancel futures returned by thread pool executors, it might lead to unexpected behaviour. Modified the executor to add new threads if all the active threads are syncing, in order to avoid deadlocks. Fixed a hidden bug in AdaptiveWorkStealingTasks, where correct behaviour depended on the execution order of the tasks. This didn't fail before with ForkJoinTasks, since there the execution order is well-defined. Scalachecked 1.5 & 1.6 support. No review.
Diffstat (limited to 'src/library/scala/collection/parallel/mutable/ParArray.scala')
-rw-r--r--src/library/scala/collection/parallel/mutable/ParArray.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library/scala/collection/parallel/mutable/ParArray.scala b/src/library/scala/collection/parallel/mutable/ParArray.scala
index a1164b7b80..909b8eb5d7 100644
--- a/src/library/scala/collection/parallel/mutable/ParArray.scala
+++ b/src/library/scala/collection/parallel/mutable/ParArray.scala
@@ -102,8 +102,11 @@ self =>
val left = remaining
if (left >= 2) {
val splitpoint = left / 2
- Seq(new ParArrayIterator(i, i + splitpoint, arr) with SCPI,
- new ParArrayIterator(i + splitpoint, until, arr) with SCPI)
+ val sq = Seq(
+ new ParArrayIterator(i, i + splitpoint, arr) with SCPI,
+ new ParArrayIterator(i + splitpoint, until, arr) with SCPI)
+ i = until
+ sq
} else {
Seq(this)
}