From efdcb3c837c8fac0c90be7f794a379c4b808147b Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sat, 26 Jan 2013 17:11:13 +0100 Subject: synchronizes toolboxes We don't guarantee thread-safety of the front end, but everything else looks good now. --- src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index fdc2613810..09f795a840 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -340,7 +340,8 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => lazy val exporter = importer.reverse } - def apply[T](f: CompilerApi => T): T = { + private val toolBoxLock = new Object + def apply[T](f: CompilerApi => T): T = toolBoxLock.synchronized { try f(api) catch { case ex: FatalError => throw ToolBoxError(s"fatal compiler error", ex) } finally api.compiler.cleanupCaches() -- cgit v1.2.3