@@ -52,7 +52,6 @@ abstract class SmtInterpolAbstractProver<T> extends AbstractProver<T> {
5252 protected final FormulaCreator <Term , Sort , Script , FunctionSymbol > creator ;
5353 protected final SmtInterpolFormulaManager mgr ;
5454 protected final Deque <PersistentMap <String , BooleanFormula >> annotatedTerms = new ArrayDeque <>();
55- protected final ShutdownNotifier shutdownNotifier ;
5655
5756 private static final String PREFIX = "term_" ; // for termnames
5857 private static final UniqueIdGenerator termIdGenerator =
@@ -63,11 +62,10 @@ abstract class SmtInterpolAbstractProver<T> extends AbstractProver<T> {
6362 Script pEnv ,
6463 Set <ProverOptions > options ,
6564 ShutdownNotifier pShutdownNotifier ) {
66- super (options );
65+ super (pShutdownNotifier , options );
6766 mgr = pMgr ;
6867 creator = pMgr .getFormulaCreator ();
6968 env = pEnv ;
70- shutdownNotifier = pShutdownNotifier ;
7169 annotatedTerms .add (PathCopyingPersistentTreeMap .of ());
7270 }
7371
@@ -109,7 +107,7 @@ public boolean isUnsat() throws InterruptedException {
109107 // by using a shutdown listener. However, SmtInterpol resets the
110108 // mStopEngine flag in DPLLEngine before starting to solve,
111109 // so we check here, too.
112- shutdownNotifier .shutdownIfNecessary ();
110+ proverShutdownManager . getNotifier () .shutdownIfNecessary ();
113111
114112 LBool result = env .checkSat ();
115113 switch (result ) {
@@ -127,7 +125,9 @@ public boolean isUnsat() throws InterruptedException {
127125 // SMTInterpol catches OOM, but we want to have it thrown.
128126 throw new OutOfMemoryError ("Out of memory during SMTInterpol operation" );
129127 case CANCELLED :
130- shutdownNotifier .shutdownIfNecessary (); // expected if we requested termination
128+ proverShutdownManager
129+ .getNotifier ()
130+ .shutdownIfNecessary (); // expected if we requested termination
131131 throw new SMTLIBException ("checkSat returned UNKNOWN with unexpected reason " + reason );
132132 default :
133133 throw new SMTLIBException ("checkSat returned UNKNOWN with unexpected reason " + reason );
@@ -244,10 +244,17 @@ public <R> R allSat(AllSatCallback<R> callback, List<BooleanFormula> important)
244244 // by using a shutdown listener. However, SmtInterpol resets the
245245 // mStopEngine flag in DPLLEngine before starting to solve,
246246 // so we check here, too.
247- shutdownNotifier .shutdownIfNecessary ();
247+ proverShutdownManager . getNotifier () .shutdownIfNecessary ();
248248 for (Term [] model : env .checkAllsat (importantTerms )) {
249249 callback .apply (Collections3 .transformedImmutableListCopy (model , creator ::encapsulateBoolean ));
250250 }
251251 return callback .getResult ();
252252 }
253+
254+ /* TODO: the shutdownNotifier is bound to the Script. But this is done in the context. It seems
255+ like it might be re-usable after a shutdown.
256+ @Override
257+ protected ShutdownManager getShutdownManagerForProverImpl() throws UnsupportedOperationException {
258+ return proverShutdownManager;
259+ }*/
253260}
0 commit comments