This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Transition to C11 atomics and memory model
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Tue, 16 Sep 2014 18:17:37 +0000
- Subject: Re: Transition to C11 atomics and memory model
- Authentication-results: sourceware.org; auth=none
- References: <1410719669 dot 4967 dot 160 dot camel at triegel dot csb>
On Sun, 14 Sep 2014, Torvald Riegel wrote:
> * All accesses to atomic vars need to use atomic_* functions. IOW, all
> non-atomic accesses are not subject to data races. The only exceptions
> is initialization (ie, when the variable is not visible to any other
> thread); nonetheless, initialization accesses must not result in data
> races with other accesses. (This exception isn't allowed by C11, but
> eases the transition to C11 atomics and likely works fine in current
> implementations; as alternative, we could require MO-relaxed stores for
> initialization as well.)
Note <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63273> regarding
MO-relaxed operations not being well-optimized. It will be important to
compare the code generated before and after any changes, and may be
necessary to map the "relaxed" operations to plain loads and stores in
some cases depending on the compiler version.
--
Joseph S. Myers
joseph@codesourcery.com