Skip to content

Commit

Permalink
Fix executor
Browse files Browse the repository at this point in the history
  • Loading branch information
pkukielka committed Jun 5, 2018
1 parent c32b177 commit 4378e54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/compiler/scala/tools/nsc/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
assertOnMain()

if (isDebugPrintEnabled) inform("[running phase " + name + " on " + currentRun.size + " compilation units]")

implicit val ec: ExecutionContext = createExecutionContext()
implicit val ec: ExecutionContextExecutor = createExecutionContext()

try {
_synchronizeNames = isParallel
Expand Down Expand Up @@ -444,6 +443,11 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
}
} finally {
_synchronizeNames = false

ec match {
case ecxs: ExecutionContextExecutorService => ecxs.shutdown()
case _ =>
}
}
}

Expand Down Expand Up @@ -483,7 +487,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
/* Depending if we are in the parallel phase or not it creates executor with fixed thread pool size or
* executor which runs everything on the current thread.
*/
private def createExecutionContext(): ExecutionContext = {
private def createExecutionContext(): ExecutionContextExecutor = {
if (isParallel) {
val parallelThreads = settings.YparallelThreads.value
val threadPoolFactory = ThreadPoolFactory(Global.this, this)
Expand Down

0 comments on commit 4378e54

Please sign in to comment.