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