diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-03-22 18:22:25 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-03-22 18:22:25 +0000 |
commit | e579152f7329a314607d33c7e3761b769b93518d (patch) | |
tree | e1ff4d301bdf7bc11b30f047645698f6aa82f800 /src/library/scala/collection/parallel/ParIterableLike.scala | |
parent | 60d9a5127cf190c90e2e3ce4f79455469dac54eb (diff) | |
download | scala-e579152f7329a314607d33c7e3761b769b93518d.tar.gz scala-e579152f7329a314607d33c7e3761b769b93518d.tar.bz2 scala-e579152f7329a314607d33c7e3761b769b93518d.zip |
Implementing foreach to work in parallel in Par...
Implementing foreach to work in parallel in ParIterableLike.
Doing a bunch of refactoring around in the collection framework to
ensure a parallel foreach is never called with a side-effecting method.
This still leaves other parts of the standard library and the compiler
unguarded.
No review.
Diffstat (limited to 'src/library/scala/collection/parallel/ParIterableLike.scala')
-rw-r--r-- | src/library/scala/collection/parallel/ParIterableLike.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala index 92c7d5ac97..50a36fa8ed 100644 --- a/src/library/scala/collection/parallel/ParIterableLike.scala +++ b/src/library/scala/collection/parallel/ParIterableLike.scala @@ -440,7 +440,9 @@ self: ParIterableLike[T, Repr, Sequential] => * @tparam U the result type of the function applied to each element, which is always discarded * @param f function applied to each element */ - override def foreach[U](f: T => U) = iterator.foreach(f) + override def foreach[U](f: T => U) = { + executeAndWaitResult(new Foreach(f, parallelIterator)) + } override def count(p: T => Boolean): Int = { executeAndWaitResult(new Count(p, parallelIterator)) |