2
基本上我正在开发一个opencv应用程序。我已经在cmake
中建立了OpenCVwith_tbb
选项。英特尔TBB在并行线程中运行一个函数?
我想使用英特尔tbb运行并行线程,在某些间隔更新一些全局变量。例如:
vector<int> mySharedVar;
void secondaryThreadFunction() {
while(true) {
Do some operations
And update mySharedVar if necessarily
usleep(1000);
}
}
int main() {
run in parallel secondaryThreadFunction;
in the master Thread keep doing something based on mySharedVar
while(true) {
do something;
}
}
如何在另一个线程上运行secondaryThreadFunction()
?