Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-03-09 11:03:54


Try the following inline changes.

Sliwa, Przemyslaw (London) wrote:
> I was though thread is created by a pointer to a function, e.g.

void AssignResult( Int& aRef, Int aVal )
{
    aRef = aVal;
}

> Int foo(int x, int y, int z)
> {
> // do something with a,b,c
> return a+b+c;
> }

Int lResult = 0;

> Boost::thread pop( boost::bind( &AssignResult
                                , boost::ref( lResult )
                                , boost::bind(&foo, a, b, c)
                                )
                    );

> // do something else
>
> pop.join();

    assert( lResult = foo( a, b, c ) );

is one possibilty. This has not been tested. The inner bind may need to be
'protected', see http://www.boost.org/libs/bind/bind.html#nested_binds.

Jeff Flinn


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