Skip to content

Commit

Permalink
Don't forget to execute pending interrupt requests when shutting down…
Browse files Browse the repository at this point in the history
… the presentation compiler.
  • Loading branch information
dragos committed May 10, 2012
1 parent 58bb2d1 commit 0d70c22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/scala/tools/nsc/interactive/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
case item: WorkItem => Some(item.raiseMissing())
case _ => Some(())
}

// don't forget to service interrupt requests
val iqs = scheduler.dequeueAllInterrupts(_.execute())

debugLog("ShutdownReq: cleaning work queue (%d items)".format(units.size))
debugLog("Cleanup up responses (%d loadedType pending, %d parsedEntered pending)"
.format(waitLoadedTypeResponses.size, getParsedEnteredResponses.size))
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/scala/tools/nsc/util/WorkScheduler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class WorkScheduler {
todo.dequeueAll(a => f(a).isDefined).map(a => f(a).get)
}

def dequeueAllInterrupts(f: InterruptReq => Unit): Unit = synchronized {
interruptReqs.dequeueAll { iq => f(iq); true }
}

/** Called from server: return optional exception posted by client
* Reset to no exception.
*/
Expand Down

0 comments on commit 0d70c22

Please sign in to comment.