Commit b977ca6e authored by Stefan Michel's avatar Stefan Michel

an Threads gearbeitet

parent b129193c
#Wed Jan 31 00:19:24 CET 2018
#Wed Jan 31 12:32:00 CET 2018
tutorport=3579
tutorhost=localhost
language=de
language=en
role=student
......@@ -62,7 +62,7 @@ public class IOController {
}
public void compile(String name) {
public boolean compile(String name) {
mainViewCreationFX.setFooterText("Kompiliere..");
saveFile(name);
ByteArrayOutputStream err = new ByteArrayOutputStream();
......@@ -75,6 +75,7 @@ public class IOController {
setUpHamster(name);
mainViewCreationFX.setFooterText("Kompilieren erfolgreich");
}
return success;
}
public void setUpHamster(String name) {
......
......@@ -103,7 +103,11 @@ public class Hamster extends Thread {
@Invisible
public void run() {
running = true;
main();
try {
main();
} catch (RuntimeException e) {
this.stopHamster();
}
running = false;
terrain.setChanged();
terrain.notifyObservers();
......
......@@ -263,7 +263,7 @@ public class Terrain extends Observable implements Serializable {
hamster.setTerrain(this);
}
public synchronized boolean isRunningThread() {
public boolean isRunningThread() {
return hamster.isRunning();
}
......
......@@ -15,10 +15,10 @@ public class ThreadManager {
}
public void startThread() {
ioController.compile(terrain.getHamsterName());
terrain.getHamster().setDaemon(true);
terrain.getHamster().start();
if (ioController.compile(terrain.getHamsterName())) {
terrain.getHamster().setDaemon(true);
terrain.getHamster().start();
}
}
public void pauseThread() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment