This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC PATCH glibc] pthread_setspecific: Provide signal-safety across keys
On Thu, 19 Oct 2017, Szabolcs Nagy wrote:
> the relevant standard for a libc implementation is iso c which has
>
> 7.14.1.1p5
> "If the signal occurs other than as the result of calling the abort
> or raise function, the behavior is undefined if the signal handler
> refers to any object with static or thread storage duration that is
> not a lock-free atomic object other than by assigning a value to an
> object declared as volatile sig_atomic_t, or the signal handler calls
> any function in the standard library other than the abort function,
> the _Exit function, the quick_exit function, or the signal function
> with the first argument equal to the signal number corresponding to
> the signal that caused the invocation of the handler."
Note that this changes following DR#462 to also allow calling
<stdatomic.h> functions for lock-free types - but that doesn't change the
principle that TLS access should work and so TLS should be allocated at
dlopen / pthread_create time.
--
Joseph S. Myers
joseph@codesourcery.com