本文整理汇总了C++中tbb::blocked_range::get_some_safe方法的典型用法代码示例。如果您正苦于以下问题:C++ blocked_range::get_some_safe方法的具体用法?C++ blocked_range::get_some_safe怎么用?C++ blocked_range::get_some_safe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tbb::blocked_range
的用法示例。
在下文中一共展示了blocked_range::get_some_safe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
void operator () (tbb::blocked_range<int> &range, tbb::task* parent_task) const {
tbb::blocked_range<int> subrange = range.get_some_safe();
long savedcnt = 0;
//while ( subrange.empty() == false && parent_task->bflws_pushed == false) {
while ( subrange.empty() == false ) {
for(int i=subrange.begin(); i<subrange.end(); i++) {
list_node *node;
if (addok(head, i, column)) {
// add the node
#ifdef QUIT_ON_SOLUTION // QUIT as soon as a solution is found
if (node!=NULL && solution == NULL) {
#endif
list_node new_node;
new_node.next = head;
new_node.row = i;
if (column+1<SIZE) {
#ifdef CUTOFF
if (column+1>=CUTOFF_LEVEL)
ser_nqueens_rec(column+1, &new_node);
else
nqueens_rec(column+1, &new_node, parent_task);
#else
nqueens_rec(column+1, &new_node, parent_task);
#endif
} else { // found a solution
//solution = &new_node;
solution_count++; //atomic
//abort()
}
#ifdef QUIT_ON_SOLUTION // QUIT as soon as a solution is found
}
#endif
} // end if addok
// else do nothing -- dead computation branch
} // end for-loop over range
#ifdef DEQUE_THRESH
if ( parent_task->task_pool_size() < DEQUE_THRESH) break;
#else
if ( parent_task->is_task_pool_empty() ) break;
#endif
subrange = range.get_some_safe();
//printf("Saved one ping-pong!\n");
//std::cout << "Saved one\n" ;
//savedcnt ++;
} // end while
//printf("Saved %d ping-pongs\n", savedcnt);
//std::cout << "Saved " << savedcnt << "\n" ;
}