Boost logo

Boost :

Subject: Re: [boost] Boost.Future & review of C++0x accepted libraries implementations
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-11-20 16:28:21


k-oli_at_[hidden] writes:

> Am Donnerstag, 20. November 2008 18:19:12 schrieb Anthony Williams:
>> k-oli_at_[hidden] writes:
>> The latest C++0x working draft (which includes those papers, and which
>> is the "feature complete" committee draft out for voting at the
>> moment) is at:
>
> How has the jss::packaged_task to be used with boost::thread?
>
> X x;
> jss::packaged_task< std::string > tsk( boost::bind( & X::execute, x) );
> jss::shared_future< std::string > f( tsk.get_future() );
> boost::thread t(
> boost::bind(
> & jss::packaged_task< std::string >::operator(),
> tsk) );
> t.join();
> std::cout << f.get() << std::endl;
>
> Does not compile because packaged_task is noncopyable.
> In the C++0x working draft std::move( tsk) was used - but how to do it with
> the current boost release?

boost::thread t(boost::move(tsk));

Anthony

-- 
Anthony Williams
Author of C++ Concurrency in Action | http://www.manning.com/williams
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Just Software Solutions Ltd, Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk