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()
?