From 5d17c8b16290df3a3f751e2c979846e70d17ef66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Tue, 1 May 2012 12:29:05 +0200 Subject: Fix interrupt handling in VariableUpdaterTask. --- same/src/main/java/com/orbekk/same/VariableUpdaterTask.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'same/src') diff --git a/same/src/main/java/com/orbekk/same/VariableUpdaterTask.java b/same/src/main/java/com/orbekk/same/VariableUpdaterTask.java index f696e17..fdc1493 100644 --- a/same/src/main/java/com/orbekk/same/VariableUpdaterTask.java +++ b/same/src/main/java/com/orbekk/same/VariableUpdaterTask.java @@ -36,13 +36,14 @@ public class VariableUpdaterTask extends Thread } private synchronized void waitFor(AtomicBoolean v) { - if (Thread.interrupted()) { + if (Thread.currentThread().isInterrupted()) { return; } while(!v.get()) { try { wait(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); return; } } @@ -54,7 +55,7 @@ public class VariableUpdaterTask extends Thread while (true) { waitFor(isReady); waitFor(hasNewValue); - if (Thread.interrupted()) { + if (Thread.currentThread().isInterrupted()) { break; } performWork(); -- cgit v1.2.3