Terminate loop explicitly on interrupted

Make explicit that the loop terminates when the current thread is
interrupted.
This commit is contained in:
Romain Vimont 2023-01-27 22:18:54 +01:00
parent bdba554118
commit 74d32e612d
2 changed files with 2 additions and 2 deletions

View file

@ -75,7 +75,7 @@ public class Controller {
SystemClock.sleep(500); SystemClock.sleep(500);
} }
while (true) { while (!Thread.currentThread().isInterrupted()) {
handleEvent(); handleEvent();
} }
} }

View file

@ -25,7 +25,7 @@ public final class DeviceMessageSender {
} }
public void loop() throws IOException, InterruptedException { public void loop() throws IOException, InterruptedException {
while (true) { while (!Thread.currentThread().isInterrupted()) {
String text; String text;
long sequence; long sequence;
synchronized (this) { synchronized (this) {