From 8418fbdaa82ab1152cd37154cb110762add943a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomas=20Wenstr=C3=B6m?= Date: Sat, 23 Mar 2019 11:57:48 +0100 Subject: [PATCH] Renamed a thread --- src/kaka/cakelight/VideoMode.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kaka/cakelight/VideoMode.java b/src/kaka/cakelight/VideoMode.java index ca0bd53..1f6d68f 100644 --- a/src/kaka/cakelight/VideoMode.java +++ b/src/kaka/cakelight/VideoMode.java @@ -7,7 +7,7 @@ import java.util.function.Consumer; public class VideoMode extends Mode { private Configuration config; - private Thread thread; + private Thread grabberThread; private Consumer frameConsumer; private VideoDeviceListener deviceListener; @@ -24,13 +24,13 @@ public class VideoMode extends Mode { @Override public void exit() { - thread.interrupt(); + grabberThread.interrupt(); deviceListener.stopListening(); } private void startGrabberThread(File videoDevice) { assert frameConsumer != null; - thread = new Thread() { + grabberThread = new Thread() { public void run() { try (FrameGrabber grabber = FrameGrabber.from(videoDevice, config)) { while (!isInterrupted()) { @@ -44,7 +44,7 @@ public class VideoMode extends Mode { } } }; - thread.start(); + grabberThread.start(); } public void onVideoFrame(Consumer consumer) { @@ -57,8 +57,8 @@ public class VideoMode extends Mode { public void onVideoDeviceChange(Optional videoDevice) { // Should only happen when this mode is active! - if (thread != null) { - thread.interrupt(); + if (grabberThread != null) { + grabberThread.interrupt(); } videoDevice.ifPresent(this::startGrabberThread); } -- 2.11.0