From e91a9370df0b14112cc1ad9f6dd11d6af72bb196 Mon Sep 17 00:00:00 2001 From: NoName11234 <47484268+NoName11234@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:18:54 +0100 Subject: [PATCH] removed threadcounter from TypeUnifyTask --- .../typeinference/unify/TypeUnifyTask.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 8d42dde0e..ab23142b7 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -72,11 +72,9 @@ public class TypeUnifyTask extends RecursiveTask>> { * Fuer die Threads */ protected UnifyResultModelParallel urm; - protected static int noOfThread = 0; private static int totalnoOfThread = 0; int thNo; protected boolean one = false; - Integer MaxNoOfThreads = 128; public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/"; protected WriterActiveObject logFile; @@ -170,8 +168,7 @@ public class TypeUnifyTask extends RecursiveTask>> { this.logFile = logFile; this.log = log; this.pool = pool; - - noOfThread++; + totalnoOfThread++; //writeLog("thNo1 " + thNo); thNo = totalnoOfThread; @@ -252,7 +249,6 @@ public class TypeUnifyTask extends RecursiveTask>> { .filter(x -> x.size()>1) .collect(Collectors.toCollection(ArrayList::new)); Set> res = unify(neweq, remainingOderconstraints, fc, parallel, rekTiefeField, new HashSet<>()); - noOfThread--; if(parallel){ logFile.close(); @@ -889,7 +885,7 @@ public class TypeUnifyTask extends RecursiveTask>> { /* Wenn parallel gearbeitet wird, wird je nach Varianz ein neuer Thread * gestartet, der parallel weiterarbeitet. */ - if(parallel && (variance == 1) && noOfThread <= MaxNoOfThreads) { + if(parallel && (variance == 1)) { Set forks = new HashSet<>(); Set newEqOrig = new HashSet<>(eq); Set> newElemsOrig = new HashSet<>(elems); @@ -939,7 +935,6 @@ public class TypeUnifyTask extends RecursiveTask>> { /* FORK ANFANG */ writeLog("wait "+ forkOrig.thNo); - noOfThread--; res = forkOrig.join(); //noOfThread++; @@ -953,7 +948,6 @@ public class TypeUnifyTask extends RecursiveTask>> { forks.forEach(x -> writeLog("wait: " + x.thNo)); for(TypeUnify2Task fork : forks) { - noOfThread--; Set> fork_res = fork.join(); //noOfThread++; @@ -970,7 +964,7 @@ public class TypeUnifyTask extends RecursiveTask>> { } //noOfThread++; } else { - if(parallel && (variance == -1) && noOfThread <= MaxNoOfThreads) { + if(parallel && (variance == -1)) { Set forks = new HashSet<>(); Set newEqOrig = new HashSet<>(eq); Set> newElemsOrig = new HashSet<>(elems); @@ -1018,7 +1012,6 @@ public class TypeUnifyTask extends RecursiveTask>> { /* FORK ANFANG */ writeLog("wait "+ forkOrig.thNo); - noOfThread--; res = forkOrig.join(); //noOfThread++; @@ -1032,7 +1025,6 @@ public class TypeUnifyTask extends RecursiveTask>> { forks.forEach(x -> writeLog("wait: " + x.thNo)); for(TypeUnify2Task fork : forks) { - noOfThread--; Set> fork_res = fork.join(); //noOfThread++; @@ -1050,7 +1042,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //noOfThread++; } else { - if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) { + if(parallel && (variance == 2)) { writeLog("var2einstieg"); Set forks = new HashSet<>(); Set newEqOrig = new HashSet<>(eq); @@ -1083,7 +1075,6 @@ public class TypeUnifyTask extends RecursiveTask>> { /* FORK ANFANG */ writeLog("wait "+ forkOrig.thNo); - noOfThread--; res = forkOrig.join(); //noOfThread++; @@ -1097,7 +1088,6 @@ public class TypeUnifyTask extends RecursiveTask>> { /* FORK ENDE */ forks.forEach(x -> writeLog("wait: " + x.thNo)); for(TypeUnify2Task fork : forks) { - noOfThread--; Set> fork_res = fork.join(); //noOfThread++; @@ -2513,13 +2503,11 @@ public class TypeUnifyTask extends RecursiveTask>> { if (log && finalresult) { if(parallel){ logFile.write("Thread no.:" + thNo + "\n" - + "noOfThread:" + noOfThread + "\n" + "parallel:" + parallel + "\n" + str+"\n\n" ); }else{ logFile.writeNonThreaded("Thread no.:" + thNo + "\n" - + "noOfThread:" + noOfThread + "\n" + "parallel:" + parallel + "\n" + str+"\n\n" );