webcam-eyetracker icon indicating copy to clipboard operation
webcam-eyetracker copied to clipboard

Various threads do not close when close() is called

Open kenjones21 opened this issue 6 years ago • 2 comments

When close is called, I believe the behavior should be that the various thread processing threads and such are signaled to close. However, if connection with the eyetracker has closed, the _alive event is never unset, and as such the threads just continue to run.

kenjones21 avatar Apr 02 '18 15:04 kenjones21

Could you be more specific? I'm assuming you're referring to the OpenCV codebase, in which the _alive Event is cleared when close is called. Or am I missing something?

Also note that all Processes and Threads are set to deamon, which means they (and their resources) are forcibly closed upon an unexpected exit. This shouldn't happen, as it can leave things in disarray, so feel free to implement a more gracious error-catching.

esdalmaijer avatar May 21 '18 09:05 esdalmaijer

Sorry for taking so long to get back to you! I am indeed referring to the OpenCV codebase. There is a possibility I'm misunderstanding something, but in the close function in generic.py, the body of the function only runs if self._connected is true. So, for instance, if I enqueue all the images I want to process and close the connection before the images are processed, the threads will never join. I think the thread joining should probably happen regardless of whether the connection was open.

kenjones21 avatar Jun 10 '18 18:06 kenjones21