Sujet : Re: portable proxy collector test...
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.archDate : 06. Dec 2024, 22:12:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vivpcg$2in59$2@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 12/6/2024 11:55 AM, Brett wrote:
Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
I am wondering if anybody can try to compile and run this C++11 code of
mine for a portable word-based proxy collector, a sort of poor mans RCU,
on an ARM based system? I don't have access to one. I am interested in
the resulting output.
https://godbolt.org
https://pastebin.com/raw/CYZ78gVj
(raw text link, no ads... :^)
[...]
It seems that all of the atomics are LDREX/STREX wrt fetch_add/sub . Even with relaxed memory order. Are the LDREX/STREX similar to the LOCK prefix on an x86/64?
https://godbolt.org/z/EPGYWve71It has loops for this in the ASM code. Adding a loop in there can change things from wait-free to lock-free. Humm...
_______________
#include <atomic>
int
main()
{
{
std::atomic<unsigned long> g_state_0(123);
g_state_0.fetch_add(1, std::memory_order_relaxed);
}
return 0;
}
_______________