【发布时间】:2016-01-09 15:27:16
【问题描述】:
我是 TBB 的新手。遇到了一个问题,希望大家多多指教。
一个名为 Fruit 的类:
Fruit.hpp:
class Fruit {
protected :
void A(...);
void B(..);
public :
Fruit();
~ Fruit();
void l1(....);
void l2(...);
};
Fruit.cpp:
custom_TBB (...){
//How to call the method A of Fruit?
}
class Fruit {
...
Fruit::l1(....){
tbb::task_scheduler_init init(numberOfThreads);
parallel_for(tbb::blocked_range<int>(0,End,10000),custom_TBB (...));
}
...
};
因为我需要在l1的功能中使用并行方法。
不知道我对TBB的理解对不对?
我想知道我怎样才能使它工作?
先谢谢你。
这是我的想法:
1.我尝试在Fruit类里面声明custom_TBB,在这里实现,但是失败了。
2.我尝试在l1的函数里面定义custom_TBB,也失败了。
【问题讨论】:
-
“失败”是什么意思。编译失败?未能将线程数设置为您的预期?
-
@timday 不能调用没有对象的成员函数 -> 错误
-
Simplest TBB example的可能重复
标签: c++ parallel-processing tbb