From add910cf6c85910d0f1b52ff0c8732556e8c26a4 Mon Sep 17 00:00:00 2001 From: TrAyZeN <31016188+TrAyZeN@users.noreply.github.com> Date: Wed, 22 Aug 2018 23:06:50 +0200 Subject: [PATCH] Update webcamvideostream.py Now stops the thread with the stop method --- imutils/video/webcamvideostream.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imutils/video/webcamvideostream.py b/imutils/video/webcamvideostream.py index dbe8751..b0cd0bf 100644 --- a/imutils/video/webcamvideostream.py +++ b/imutils/video/webcamvideostream.py @@ -18,9 +18,9 @@ def __init__(self, src=0, name="WebcamVideoStream"): def start(self): # start the thread to read frames from the video stream - t = Thread(target=self.update, name=self.name, args=()) - t.daemon = True - t.start() + self._thread = Thread(target=self.update, name=self.name, args=()) + self._thread.daemon = True + self._thread.start() return self def update(self): @@ -40,3 +40,4 @@ def read(self): def stop(self): # indicate that the thread should be stopped self.stopped = True + self._thread.join()