[PATCH 2/2] manual: Document __libc_single_threaded
Szabolcs Nagy
szabolcs.nagy@arm.com
Thu May 21 13:09:27 GMT 2020
The 05/21/2020 09:50, Adhemerval Zanella via Libc-alpha wrote:
> On 20/05/2020 15:12, Florian Weimer via Libc-alpha wrote:
>
> > +@smallexample
> > +if (__libc_single_threaded)
> > + atomic_fetch_add (&reference_count, 1, memory_order_relaxed);
> > +else
> > + atomic_fetch_add (&reference_count, 1, memory_order_acq_rel);
> > +@end smallexample
>
> Shouldn't the access to __libc_single_threaded be atomic itself
> (at least with relaxed semantic)?
not if we guarantee that this object can only be
written while the process is single threaded.
(e.g. an exiting detached thread cannot update it
even if only one thread left.. because that may
concurrently read it)
More information about the Libc-alpha
mailing list