Methode run() in Printer.java korrigiert.
This commit is contained in:
parent
662dbdd021
commit
2e7bf12166
|
@ -15,6 +15,7 @@ public class Printer {
|
||||||
private static class PrinterThread extends Thread {
|
private static class PrinterThread extends Thread {
|
||||||
char symbol;
|
char symbol;
|
||||||
int sleepTime;
|
int sleepTime;
|
||||||
|
Thread current_thread = this;
|
||||||
|
|
||||||
public PrinterThread(String name, char symbol, int sleepTime) {
|
public PrinterThread(String name, char symbol, int sleepTime) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -24,7 +25,7 @@ public class Printer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(Thread.currentThread().getName().equals("main")){
|
if(Thread.currentThread() != current_thread){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println(getName() + " run started...");
|
System.out.println(getName() + " run started...");
|
||||||
|
|
Loading…
Reference in New Issue