Published in Ramblings

Published in Ramblings

Published in Ramblings

Image credit by Ben Griffiths

Image credit by Ben Griffiths

Image credit by Ben Griffiths

Image
Image
Image

Sophia Tung

Sophia Tung

Sophia Tung

April 3, 2015

April 3, 2015

April 3, 2015

Difficulties in Multithreading

Difficulties in Multithreading

Difficulties in Multithreading

Difficulties in Multithreading

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.

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.

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.