Yices2: improve access to static field.
@@ -59,6 +59,7 @@ public class Yices2SolverContext extends AbstractSolverContext {
public static Yices2SolverContext create(
NonLinearArithmetic pNonLinearArithmetic, ShutdownNotifier pShutdownManager) {
+ synchronized (Yices2SolverContext.class) {
if (numLoadedInstances == 0) {
// Avoid loading and initializing twice,
// because this would make all existing terms and types unavailable,
@@ -67,6 +68,7 @@ public class Yices2SolverContext extends AbstractSolverContext {
yices_init();
}
numLoadedInstances++;
+ }
Yices2FormulaCreator creator = new Yices2FormulaCreator();
Yices2UFManager functionTheory = new Yices2UFManager(creator);
@@ -94,12 +96,14 @@ public class Yices2SolverContext extends AbstractSolverContext {
}
@Override
- public void close() {
+ public synchronized void close() {
+ synchronized (Yices2SolverContext.class) {
numLoadedInstances--;
if (numLoadedInstances == 0) {
yices_exit();
}
}
+ }
@Override
protected ProverEnvironment newProverEnvironment0(Set<ProverOptions> pOptions) {
