Published in Ramblings
Image credit by Ben Griffiths
Sophia Tung
April 3, 2015
Difficulties in Multithreading
Difficulties in Multithreading
Why is the following bad?
class MyThread extends Thread { private boolean stop = false; public void run() { while (!stop) { doSomeWork(); } } public void setStop() { this.stop = true; } }
Think about it.