I have a Lua daemon running on an OpenWrt Box which periodically checks for data on multiple USB-Serial (ACM) devices using librs232 (https://github.com/ynezz/librs232.git).
The problem that I am having is that now and again (about once in 24 hours) one of the USB devices will randomly lock up and block during what should be a non-blocking read operation. I need to be able to detect this condition and abort the read operation.
Presently, I am thinking that the best solution is to launch a separate thread for each USB device, but I am unsure as to how to 'kill' the locked up thread when it's (non-blocking) read operation hangs.
For emphasis, I am looking for a Lua based solution.
Does anyone have any ideas?