This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Proposal: Slow dynamic TLS for internal glibc use
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 23 Oct 2018 20:50:57 +0000
- Subject: Re: Proposal: Slow dynamic TLS for internal glibc use
- References: <87ftwwvosz.fsf@oldenburg.str.redhat.com>
On Tue, 23 Oct 2018, Florian Weimer wrote:
> I'm working to get clarification for C2X that this is a valid
> implementation for the functions where C11 wasn't updated accordingly
> when objects of thread storage duration were introduced.
I'd suggest that for C2X it might be appropriate to require these
functions to use thread-local storage for their state (and likewise for
the next major revision of POSIX, for POSIX functions), rather than
leaving the possibility of them being unsafe with threads.
Note that for some of them (e.g. strerror, localtime), using TLS is
unambiguously OK; it's only those storing an internal state to be used by
subsequent calls, as opposed to storing output data in some internal
location to which a pointer is returned, for which there is some ambiguity
about whether using them with threads and separate synchronization between
calls in different threads is meant to share state between the threads.
--
Joseph S. Myers
joseph@codesourcery.com