Deutsch   English   Français   Italiano  
<vc8s1d$2okha$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Paavo Helde <eesnimi@osa.pri.ee>
Newsgroups: comp.lang.c++
Subject: Re: Atomic caching of smart pointers
Date: Mon, 16 Sep 2024 11:59:25 +0300
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <vc8s1d$2okha$1@dont-email.me>
References: <vc7ahq$2akr4$1@dont-email.me> <vc8mjk$2ni31$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 16 Sep 2024 10:59:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f6e27e69d6c0876481dc48587d67b57a";
	logging-data="2904618"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19hZauYNR4PlWyhOEFCwywUdu1dRjoKI+Y="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Yj4r3UsUAtkftC5skRTqb2U11Sw=
Content-Language: en-US
In-Reply-To: <vc8mjk$2ni31$1@dont-email.me>
Bytes: 1783

On 16.09.2024 10:26, Muttley@dastardlyhq.com wrote:
> On Sun, 15 Sep 2024 21:54:50 +0300
> Paavo Helde <eesnimi@osa.pri.ee> boringly babbled:
>> So, what do you think? Should I just use std::atomic<std::shared_ptr>
>> instead? Any other suggestions? Did I get the memory order parameters
>> right in compare_exchange_weak()?
> 
> Looks to me like you're simply protecting the pointers rather than the data
> they're actually pointing to but I only skim read it.

You are right, at the moment I am interested in protecting the pointers.

The pointed data will be immutable after initial creation (except for 
potential refcounter updates inside it, but the refcounters are atomic 
anyway, so no problems there).