Proposal: Slow dynamic TLS for internal glibc use
Joseph Myers
joseph@codesourcery.com
Tue Oct 23 20:52:00 GMT 2018
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
More information about the Libc-alpha
mailing list