|
Boost Users : |
From: Pedro Lamarão (pedro.lamarao_at_[hidden])
Date: 2006-03-09 14:28:09
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net