modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

Aufruf von isCanceled an verschiedenen Stellen ergaenzt, so dass jetzt alle Prozesse angehalten werden sollten
This commit is contained in:
pl@gohorb.ba-horb.de 2020-03-03 14:52:11 +01:00
parent e07df035ea
commit 900a487d8a

View File

@ -186,6 +186,12 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
usedTasks.cancel();
writeLog(nOfUnify.toString() + "cancel");
System.out.println("cancel");
try {
logFile.write("Abbruch");
}
catch (IOException e) {
System.err.println("log-File nicht vorhanden");
}
}
*/
rules = new RuleSet(logFile);
@ -303,6 +309,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
/*
* Step 1: Repeated application of reduce, adapt, erase, swap
*/
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
rekTiefe++;
nOfUnify++;
@ -463,7 +474,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// .collect(Collectors.toCollection(HashSet::new));
//Muss auskommentiert werden, wenn computeCartesianRecursive ENDE
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
@ -907,6 +922,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("wait "+ forkOrig.thNo);
noOfThread--;
res = forkOrig.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
forkOrig.writeLog("final Orig 1");
forkOrig.closeLogFile();
@ -922,6 +942,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
synchronized (this) {
noOfThread--;
Set<Set<UnifyPair>> fork_res = fork.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
writeLog("Join " + new Integer(fork.thNo).toString());
//noOfThread--; an das Ende von compute verschoben
@ -1013,6 +1038,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("wait "+ forkOrig.thNo);
noOfThread--;
res = forkOrig.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
forkOrig.writeLog("final Orig -1");
forkOrig.closeLogFile();
@ -1028,6 +1058,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
synchronized (this) {
noOfThread--;
Set<Set<UnifyPair>> fork_res = fork.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
writeLog("Join " + new Integer(fork.thNo).toString());
//noOfThread--; an das Ende von compute verschoben
@ -1089,6 +1124,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("wait "+ forkOrig.thNo);
noOfThread--;
res = forkOrig.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
forkOrig.writeLog("final Orig 2");
forkOrig.closeLogFile();
@ -1103,6 +1143,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
synchronized (this) {
noOfThread--;
Set<Set<UnifyPair>> fork_res = fork.join();
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
}
//noOfThread++;
writeLog("Join " + new Integer(fork.thNo).toString());
//noOfThread--; an das Ende von compute verschoben