• Alexander Alekhin's avatar
    core: fix pthreads performance · c49d5d52
    Alexander Alekhin authored
    OpenCV pthreads-based implementation changes:
    - rework worker threads pool, allow to execute job by the main thread too
    - rework synchronization scheme (wait for job completion, threads 'pong' answer is not required)
    - allow "active wait" (spin) by worker threads and by the main thread
    - use _mm_pause() during active wait (support for Hyper-Threading technology)
    - use sched_yield() to avoid preemption of still working other workers
    - don't use getTickCount()
    - optional builtin thread pool profiler (disabled by compilation flag)
    c49d5d52
parallel_impl.hpp 555 Bytes
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_CORE_PARALLEL_IMPL_HPP
#define OPENCV_CORE_PARALLEL_IMPL_HPP

namespace cv {

unsigned defaultNumberOfThreads();

void parallel_for_pthreads(const Range& range, const ParallelLoopBody& body, double nstripes);
size_t parallel_pthreads_get_threads_num();
void parallel_pthreads_set_threads_num(int num);

}

#endif // OPENCV_CORE_PARALLEL_IMPL_HPP