Header-only C++17 cv::parallel::ParallelForAPI backend for Sensoraia. More...
#include <opencv2/core.hpp>#include <opencv2/core/parallel/parallel_backend.hpp>#include <algorithm>#include <atomic>#include <condition_variable>#include <cstddef>#include <cstdint>#include <exception>#include <memory>#include <mutex>#include <new>#include <system_error>#include <thread>#include <utility>#include <vector>

Go to the source code of this file.
Data Structures | |
| class | usher_cv_parallel::ThreadPoolBackend |
| Persistent std::thread pool implementing cv::parallel::ParallelForAPI. More... | |
| struct | usher_cv_parallel::ThreadPoolBackend::Worker |
| Per-worker state owned until after its std::thread has joined. More... | |
| class | usher_cv_parallel::ScopedBackend |
| RAII guard installing the backend at startup and joining workers before main() exits. More... | |
Namespaces | |
| namespace | usher_cv_parallel |
| Deterministic, race-free std::thread backend for OpenCV parallel regions. | |
Functions | |
| const std::shared_ptr< ThreadPoolBackend > & | usher_cv_parallel::ensure_installed () |
| Install the process-wide Sensoraia OpenCV parallel backend once. | |
Detailed Description
Header-only C++17 cv::parallel::ParallelForAPI backend for Sensoraia.
Replaces OpenCV's internal pthreads thread pool (parallel_impl.cpp, disabled at build time with -DWITH_PTHREADS_PF=OFF) so ext/opencv remains an unmodified upstream release tag while all multi-threaded cv::parallel_for_ regions execute without lock-free data races under both GCC and Clang.
Worker threads are created lazily on the first parallel region that needs more than one thread, parked on a condition variable between regions to avoid per-call thread-creation overhead, and joined deterministically when cv::setNumThreads(1) is requested or when the outermost ScopedBackend guard leaves main().
Definition in file opencv_parallel.hpp.