C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::shared_ptr resurrect

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 12 Dec 2023 14:01:02 -0300
On Tuesday, 12 December 2023 08:56:21 -03 Valentin Palade wrote:
> The main requirements behind resurrect are:
>
> 1. lock free
> 2. preserving the control block that was allocated initially for the
> object.
>
> Because of the second idea, we cannot efficiently move away from the old
> pointer as we'll need to reallocate the control block.

Your conclusion does not follow from the facts. Why do you think that moving
will cause it to reallocate?

Yes, as discussed, depending on a race, you could end up freeing a block. I
wouldn't expect this to be a problem for an optimisation. It's just a best
effort.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-12-12 17:01:08