C++ Logo

std-proposals

Advanced search

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

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Tue, 12 Dec 2023 18:16:22 +0100
wt., 12 gru 2023 o 18:01 Thiago Macieira <thiago_at_[hidden]> napisał(a):
>
> 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.
>

I could argue a bit longer but Lénárd's email makes the proposal DoA.
Existence of `weak_pointer` makes `resurrect` at best unreliable.

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

Received on 2023-12-12 17:16:34