Deutsch   English   Français   Italiano  
<vkd20o$1fk7q$1@dont-email.me>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jseigh <jseigh_es00@xemaps.com>
Newsgroups: comp.arch
Subject: Re: Strange asm generated by GCC...
Date: Mon, 23 Dec 2024 20:16:08 -0500
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <vkd20o$1fk7q$1@dont-email.me>
References: <vk2ek2$33ckv$3@dont-email.me> <vk4ahk$3i1bs$1@dont-email.me>
 <At6cnfsh1ZzpB_v6nZ2dnZfqn_adnZ2d@supernews.com>
 <vkamjt$11jv0$2@dont-email.me> <vkamr2$11jv0$3@dont-email.me>
 <h0ydnQ-XeaVIvfT6nZ2dnZfqnPednZ2d@supernews.com>
 <vkck71$1cp7c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 24 Dec 2024 02:16:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5114aa0239ab98b3f55066a4f18d919b";
	logging-data="1560826"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19w1Q67kYOqSd/Bid/NmNTh"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:6xNnLCGvrt3DuL509Ln6Jxp9jzA=
In-Reply-To: <vkck71$1cp7c$1@dont-email.me>
Content-Language: en-US
Bytes: 1895

On 12/23/24 16:20, Chris M. Thomasson wrote:

> 
> Wrt a traditional lock-free stack, I think the store can use relaxed for 
> the success path of a CAS.

For pushing onto a stack, you want release.  For popping from a stack
you want acquire.

You are probably ok using relaxed loading the old value.  It's not
real clear how aggressive the compiler is allowed to be with relaxed
loads and stores.  To be super safe, you might want to add acquire
to all your cas loops.

I would just stick with the compare_exchange w/ 1 memory order
parameter.  The success/fail form is just confusing, the fail
parameter doesn't do anything.