-
Notifications
You must be signed in to change notification settings - Fork 5
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
Camera::new()
modifies global state to do discovery.
#8
Comments
Actually, distinct Aravis objects should already be safe to use from different threads according to: https://aravisproject.github.io/docs/aravis-0.8/thread-safety.html
Additionally, the global state used for camera discovery appears to be protected by a mutex: There may still be race conditions in performing discovery and enumerating the results without additional locking though. That needs a bit more inspection. |
Hi Maarten,
But the rest of the API in |
Hey Emmanuel, Thanks for the clarification. I figured as much. We don't want other threads to interleave their To be clear, if we've used the above functions properly, and then call The next bit is mostly at myself, so I don't forget: I think the thread safety wrapper I added is a bit broken. The intent was to have a global token that can only be instantiated once, which would not be shareable with other threads. However, looking back at the code, I don't see anything that prevents sharing it with other threads. The token can not be cloned, but nothing prevents you from moving it into an I'm thinking it's probably better to just use a global mutex instead. That also means users don't need to worry about how and when they obtain the token, at the cost of potentially blocking in a multi-threaded environment. |
Yes, |
Ah, so |
It is the other way around, |
Ah, ok. Either way, more locking :) Thank again for the extra information. |
arv_camera_new()
internally does camera discovery. This modifies global state inside Aravis, so it's probably not thread safe.The method needs to acquire a global lock. Either we can re-use the
Aravis
struct, or switch to an actual global lock.The text was updated successfully, but these errors were encountered: