-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
UVC device power #13082
base: development
Are you sure you want to change the base?
UVC device power #13082
Conversation
…evice power in one while the other still needs it
auto & dev = environment::get_instance().get_uvc_device( info.unique_id ); | ||
if( ! dev ) | ||
{ | ||
dev = get_backend()->create_uvc_device( info ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually does a set...
I.e., the next line means nothing.
But this is also dangerous if multiple threads are in this same loop.
return _device_info_uid_to_uvc_device[uvc_device_info_uid]; | ||
} | ||
|
||
void set_uvc_device( const std::string & uvc_device_info_uid, std::shared_ptr< platform::uvc_device > & device ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK but the device is NEVER removed! I don't think that's what we want.
We want it to be removed when the last reference to it is gone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that not only is it never removed but if we have new info with the same ID then we'll use the old one. I don't know if this will ever happen - but it'd be worth checking.
DRAFT ONLY, to share the code we have discussed during our meeting