diff --git a/code/Printer/src/main/java/ch/zhaw/prog2/printer/Printer.java b/code/Printer/src/main/java/ch/zhaw/prog2/printer/Printer.java index f14b654..9b1088f 100644 --- a/code/Printer/src/main/java/ch/zhaw/prog2/printer/Printer.java +++ b/code/Printer/src/main/java/ch/zhaw/prog2/printer/Printer.java @@ -15,6 +15,7 @@ public class Printer { private static class PrinterThread extends Thread { char symbol; int sleepTime; + Thread current_thread = this; public PrinterThread(String name, char symbol, int sleepTime) { super(name); @@ -24,7 +25,7 @@ public class Printer { @Override public void run() { - if(Thread.currentThread().getName().equals("main")){ + if(Thread.currentThread() != current_thread){ return; } System.out.println(getName() + " run started...");