请教,关于tbb
我把下边这个类用parallel_reduce调用当tbb::task_scheduler_init init(1)时只执行一半,而不是按单线程方式全部执行,请问这是为什么呢?
class tbb_detection
{
public:
tbb_detection(){};
std::vector<cv::Mat> v_image;
std::vector<c_rect> v_crect;
void operator ()(tbb::blocked_range<int>& rang)
{
for(int i=rang.begin();i<rang.end();i++)
{
v_crect=detection(v_image[i]);
}
}
tbb_detection(tbb_detection& x,tbb::split):v_image(x.v_image),v_crect(0)
{}
void join(const tbb_detection& y)
{
v_crect.insert(v_crect.end(),y.v_crect.begin(),y.v_crect.end());
}
};