Boost logo

Boost :

Subject: Re: [boost] [future William proposal] packaged_task do not acceptboost::ref of a nullary functor
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-01-05 06:49:49


"vicente.botet" <vicente.botet_at_[hidden]> writes:

> From: "vicente.botet" <vicente.botet_at_[hidden]>

>> packaged_task do not accept boost::ref to nullary functions while
>> thread allows it. Shouldn't packaged_task > accept them? How can
>> the user workaround this issue? How thread solved this issue?
>
> I have found a workaround. Instead of
> boost::packaged_task<unsigned > tsk(boost::ref(f));
> I use
> boost::packaged_task<unsigned> tsk(boost::bind(boost::ref(f)));
>
> Is this the correct way?

That's essentially what Boost.Thread does.

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