diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 551f7e1b40..3b6b7a1a7f 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -118,14 +118,15 @@ class Interpreter(val settings: Settings, out: PrintWriter) { // set up initialization future private var _isInitialized: () => Boolean = () => false - def initialize() { + def initialize() = synchronized { if (!_isInitialized()) _isInitialized = scala.concurrent.ops future _initialize() } /** the public, go through the future compiler */ lazy val compiler: Global = { - _isInitialized() // blocks until it is + initialize() + _isInitialized() // blocks until it is _compiler } |