This is the mail archive of the
mailing list for the glibc project.
Re: Proposal: Slow dynamic TLS for internal glibc use
* Joseph Myers:
> 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.
That's not the feedback I got during the WG14 meeting in Brno earlier
this year. Maybe I should ask on the reflector before revising the
> 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.
If you use TLS for these functions, the data goes away when the thread
exits, so it's still observable that the data is per-thread.