If you are connected with C ++ 03 and tbb, you should use Outputarguments, which means you need to rewrite your function.
eg:.
void GetSomething(int* out_ptr); int var = 23; tbb::tbb:thread(GetSomething, &var);
or with boost::ref you can do this:
void GetSomething(int& out); int var = 23; tbb::tbb_thread(GetSomething, boost::ref(var));
If you can use C ++ 11, simplify the task with futures :
eg:.
std::future<int> fut = std::async(std::launch::async, GetSomething); ....
You donβt need to rewrite anything here.
source share