Hi everyone,
I am working with a library (HIDLibrary) to read from and hid device (eHome Infraread Transceiver, aka Windows Media Center Remote) to read from a universal remote control. The library functions perfectly, even with other devices. However, my problem lies in the fact that I am running my polling function in another thread, as the library's read function blocks the thread until input is received. While my app is running, this is fine, but of course not when trying to close my app. Calling the library's CloseDevice() function does not cancel the read either. Would any of you kind people happen to know the correct way to kill a thread blocked during an IO call? I've heard of P/Invoke to TerminateThread but also read that is not recommended. Any insight would be helpful. Thank you.
I am working with a library (HIDLibrary) to read from and hid device (eHome Infraread Transceiver, aka Windows Media Center Remote) to read from a universal remote control. The library functions perfectly, even with other devices. However, my problem lies in the fact that I am running my polling function in another thread, as the library's read function blocks the thread until input is received. While my app is running, this is fine, but of course not when trying to close my app. Calling the library's CloseDevice() function does not cancel the read either. Would any of you kind people happen to know the correct way to kill a thread blocked during an IO call? I've heard of P/Invoke to TerminateThread but also read that is not recommended. Any insight would be helpful. Thank you.
Comment