9 Mar
2006
9 Mar
'06
7:28 p.m.
Sliwa, Przemyslaw (London) escreveu:
I was though thread is created by a pointer to a function, e.g.
Int foo(int x, int y, int z) { // do something with a,b,c return a+b+c; }
Boost::thread pop(boost::bind(&foo, a, b, c)); // do something else
pop.join();
The question is how to retrieve the result from foo running in pop.
void foo_wrapper (int x, int y, int z, int& out) { out = foo(x, y, z); } int retval = 0; boost::thread pop( boost::bind(&foo_wrapper, a, b, c, retval) ); pop.join(); // Check retval. -- Pedro LamarĂ£o