-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thread safe? #45
Comments
The Windows implementation is not entirely thread safe. There should not Alan. |
Ok, I found the problem to be in fact an issue in the device firmware. However I still wonder, what do you mean by the windows version is not entierly safe? I have 1 thread constantly running hid_enumerate to dynamically manage device connect/disconnect. Device IO is done by other threads. Do you see a potential problem with this? |
I think that should be fine. |
Windows implementation is not thread-safe at all. Simply because (but not only) register_error function is not thread safe and that function is actually called from almost everywhere in hid.c. To resolve it the following block would have be made thread safe: |
More than that would need to be changed. |
WINDOWS
I'm having problems when running hid_enumerate and hid_read/hid_write in different threads. I'm not sure if hidapi is supposed to be thread safe and the problem is in fact in my firmware device code, or if this is hidapi that's the problem.
Sooner or later my host code doesn't work anymore as the hid_read/hid_write fail and this only happens while a 2nd thread using hid_enumerate is active.
The text was updated successfully, but these errors were encountered: