-
Notifications
You must be signed in to change notification settings - Fork 77
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
Should more DeviceHandle
methods take a shared self
reference?
#148
Comments
You can share |
I see your point, but these decisions were already made by libusb authors, so I would say that a wrapper shouldn't place additional restrictions. Rather, it should do whatever libusb would do if In my case, I wrote a wrapper around libusb's async transfer API, which required putting the |
Ok. I am agree. I will try to make new update for library. But I think it will be at the end of October or begin November. It will be breaking changes. |
Just take note As for rusb, I think it does not really need to follow libusb in this aspect. |
Change the following methods to accept a non-exclusive reference: - DeviceHandle::set_active_configuration - DeviceHandle::unconfigure - DeviceHandle::reset - DeviceHandle::clear_halt - DeviceHandle::detach_kernel_driver - DeviceHandle::attach_kernel_driver - DeviceHandle::set_auto_detach_kernel_driver - DeviceHandle::claim_interface - DeviceHandle::release_interface - DeviceHandle::set_alternate_setting This is safe to do because libusb is thread-safe. Fixes a1ien#148
Change the following methods to accept a non-exclusive reference: - DeviceHandle::set_active_configuration - DeviceHandle::unconfigure - DeviceHandle::reset - DeviceHandle::clear_halt - DeviceHandle::detach_kernel_driver - DeviceHandle::attach_kernel_driver - DeviceHandle::set_auto_detach_kernel_driver - DeviceHandle::claim_interface - DeviceHandle::release_interface - DeviceHandle::set_alternate_setting This is safe to do because libusb is thread-safe. Fixes a1ien#148
libusb is generally thread-safe, and since
DeviceHandle
isn't reference-counted, it seems like more methods (e.g.reset
,clear_halt
,set_alternate_setting
, etc.) should take&self
rather than&mut self
to enable shared usage viaArc<DeviceHandle<T>>
. Thoughts?The text was updated successfully, but these errors were encountered: