Boost logo

Boost :

Subject: Re: [boost] Futures Review - minor implementation details
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-01-20 13:05:47


----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, January 20, 2009 12:40 PM
Subject: Re: [boost] Futures Review - minor implementation details

>
> "vicente.botet" <vicente.botet_at_[hidden]> writes:
>
>> Hi Anthony,
>>
>> Some minor implementation details:
>> Why there is not other.future reset in
>> shared_future(shared_future && other)
>> {
>> future.swap(other.future);
>> }
>> shared_future(unique_future<R> && other)
>> {
>> future.swap(other.future);
>> }
>>
>> How the move is made?
>
> These are the constructors. The "future" member is initially NULL, so
> the swap sets "other.future" to NULL whilst transferring the value
> from "other.future" to "this->future"

OK, I see.
 
>> Is
>> future.swap(other.future);
>> other.future.reset(); (1)
>> more efficient than
>> future.reset(other.future);
>> other.future.reset();
>> ? Otherwise you can change it in:
>
> The former avoids incrementing any reference counts. The
> latter has to increase the reference count on *other.future just to
> decrease it again with the reset.

I see.

Thanks,
Vicente


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