Thread Safe
Hello.
OpenCV is Thread Safe. How is this achieved deep down in the code? What patterns or techniques are used?
Regards,
Daniel
I've had a few thread glitches while using OpenCV.
The library itself is thread safe in that you can have multiple calls into the library at the same time, however the data is not always thread safe.
This means that if you have to pass a mat image between threads you have to use a mutex and call .CopyTo() to force a copy instead of a reference.
Note: Std::Vector is also not thread safe under all conditions as well.
Like he said, since OpenCV uses extensive internal use of the vector class, achieving thread safety is not always that easy ...
Asked: 2014-04-27 22:40:30 -0600
Seen: 11,730 times
Last updated: Apr 28 '14