I was able to find the root cause of the issue: When closing the device, the listening thread is not notified via the signal condition variable. Instead the condition is simply destroyed, causing the thread to be stuck forever.
Attached is a very simple diff which fixes the problem by notifying the thread before destroying the condition. Please let me know if you have any questions. I would highly appreciate it if someone can sponsor the bug. Best regards, David
fix.diff
Description: Binary data