Index: RunnableForThrougputComputation.java =================================================================== --- RunnableForThrougputComputation.java (revision 2296) +++ RunnableForThrougputComputation.java (working copy) @@ -1,5 +1,7 @@ package ch.qos.logback.core.issue; +import java.util.concurrent.atomic.AtomicBoolean; + /** * A runnable with 'done' and 'counter' fields. * @@ -8,7 +10,7 @@ */ abstract public class RunnableForThrougputComputation implements Runnable { - protected boolean done = false; + protected AtomicBoolean done = new AtomicBoolean(); protected long counter = 0; public long getCounter() { @@ -16,11 +18,11 @@ } public void setDone(boolean done) { - this.done = done; + this.done.set(done); } public boolean isDone() { - return done; + return done.get(); } } Index: SelectiveLockRunnable.java =================================================================== --- SelectiveLockRunnable.java (revision 2296) +++ SelectiveLockRunnable.java (working copy) @@ -47,7 +47,7 @@ FAIR_LOCK.lock(); counter++; FAIR_LOCK.unlock(); - if (done) { + if (isDone()) { return; } } @@ -58,7 +58,7 @@ UNFAIR_LOCK.lock(); counter++; UNFAIR_LOCK.unlock(); - if (done) { + if (isDone()) { return; } } @@ -67,7 +67,7 @@ void nolockRun() { for (;;) { counter++; - if (done) { + if (isDone()) { return; } } @@ -78,7 +78,7 @@ synchronized (LOCK) { counter++; } - if (done) { + if (isDone()) { return; } }