Open
Description
The wrong forkJoinPool is used in the following example:
implicit val someForkJoinPoolExecutionContext = ...
val otherForkJoinPoolEC = ...
val someCollection = ...
def foo() {
// Future runs in someForkJoinPoolExecutionContext
Future{
val parCollection = someCollection.par
parCollection.tasksupport = new ExecutionContextTaskSupport(otherForkJoinPoolEC)
// this is executed in the someForkJoinPoolExecutionContext rather than otherForkJoinPoolEC
parCollection.foreach(...)
}
}
In Tasks.scala, we see at line 420:
https://github.com/scala/scala/blob/5cb3d4ec14488ce2fc5a1cc8ebdd12845859c57d/src/library/scala/collection/parallel/Tasks.scala#L420
if (Thread.currentThread.isInstanceOf[ForkJoinWorkerThread]) {
Which overrides the given tasksupport, preferring the executioncontext of the currentThread.
Metadata
Metadata
Assignees
Labels
No labels