import java.util.LinkedList; import java.util.Queue; public class GOLThread extends Thread { public GOLThread(GameOfLife gol) { this.gol = gol; } GameOfLife gol; Queue work = new LinkedList<>(); boolean exiting = false; boolean pointsProcessed = false; public void exiting() { exiting = true; } private Environment env; public Environment getEnv() { return env; } public void pointsProcessed() { pointsProcessed = true; } public void addPoint(Point p) { work.add(p); } @Override public void run() { while (true) { while (!work.isEmpty() && !exiting) { Point poll = work.poll(); } if (exiting) { return; } try { sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } }