This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC interpretation of C11 atomics (DR 459)
On Tue, 2018-02-27 at 16:40 +0000, Simon Wright wrote:
> On 27 Feb 2018, at 12:56, Ruslan Nikolaev via gcc <gcc@gcc.gnu.org> wrote:
> >
> > And all this mess to accommodate almost non-existent case when someone wants to use atomic_load on read-only memory for wide types, in which no good solution exists anyway
>
> Sorry to butt in, but - if it's ROM why would you need atomic load anyway? (of course, if it's just a constant view of the object, reason is obvious)
Consider a producer-consumer relationship between two processes where
the producer doesn't want to wait for the consumer. For example, the
producer could be an application that's being traced, and the consumer
is a trace aggregation tool. The producer can provide a read-only
mapping to the consumer, and put a nonblocking ring buffer or something
similar in there. That allows the consumer to read, but it still needs
atomic access because the consumer is modifying the ring buffer
concurrently.