public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Amar Memic" <amemic@uni-osnabrueck.de>
To: libstdc++@gcc.gnu.org
Subject: 6.55 Built-in Functions for Memory Model Aware Atomic Operations
Date: Wed, 21 Jul 2021 10:20:32 +0200	[thread overview]
Message-ID: <49b2-60f7d900-cf7-23647ec0@27167096> (raw)


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

             reply	other threads:[~2021-07-21  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  8:20 Amar Memic [this message]
2021-07-21  9:47 ` Jonathan Wakely
2021-07-21  9:49   ` Jonathan Wakely
2021-07-21 13:09     ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49b2-60f7d900-cf7-23647ec0@27167096 \
    --to=amemic@uni-osnabrueck.de \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).