* 6.55 Built-in Functions for Memory Model Aware Atomic Operations
@ 2021-07-21 13:00 Amar Memic
2021-07-21 13:08 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Amar Memic @ 2021-07-21 13:00 UTC (permalink / raw)
To: gcc
Hi,6.55 Built-in Functions for Memory Model Aware Atomic Operations (https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html) says:Note that the ‘__atomic’ builtins assume that programs will conform to the C++11 memory model. In particular, they assume that programs are free of data races. See the C++11 standard for detailed requirements.
I think the second sentence is a bit misleading because atomics should handle data races.
Especially, interleaving read/write or write/write operations should be well-defined.
If you assume that programs are free of data races, then you could not implement spinlock based on these atomics, for example.
I hope you can help me to interpret the paragraph in the right manner.
Thanks in advance
Amar Memic
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: 6.55 Built-in Functions for Memory Model Aware Atomic Operations
2021-07-21 13:00 6.55 Built-in Functions for Memory Model Aware Atomic Operations Amar Memic
@ 2021-07-21 13:08 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-07-21 13:08 UTC (permalink / raw)
To: Amar Memic; +Cc: gcc
N.B. I already answered this when you sent it to the libstdc++ list,
read past the first line of my reply:
https://gcc.gnu.org/pipermail/libstdc++/2021-July/052932.html
On Wed, 21 Jul 2021 at 14:00, Amar Memic <amemic@uni-osnabrueck.de> wrote:
>
>
> Hi,6.55 Built-in Functions for Memory Model Aware Atomic Operations (https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html) says:Note that the ‘__atomic’ builtins assume that programs will conform to the C++11 memory model. In particular, they assume that programs are free of data races. See the C++11 standard for detailed requirements.
>
> I think the second sentence is a bit misleading because atomics should handle data races.
> Especially, interleaving read/write or write/write operations should be well-defined.
> If you assume that programs are free of data races, then you could not implement spinlock based on these atomics, for example.
> I hope you can help me to interpret the paragraph in the right manner.
>
> Thanks in advance
> Amar Memic
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-21 13:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 13:00 6.55 Built-in Functions for Memory Model Aware Atomic Operations Amar Memic
2021-07-21 13:08 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).