This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Async-signal-safe access to __thread variables from dlopen()edlibraries?
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: Paul Pluzhnikov <ppluzhnikov at google dot com>, libc-alpha at sourceware dot org, iant at google dot com
- Date: Wed, 13 Jun 2012 11:28:26 -0700 (PDT)
- Subject: Re: Async-signal-safe access to __thread variables from dlopen()edlibraries?
- References: <20120612193224.8E43619060E@elbrus2.mtv.corp.google.com><4FD8D974.7090903@twiddle.net>
The obvious workaround is to make sure each thread has referred to a given
__thread variable before a signal handler it runs might refer to it. That
will ensure the dynamic linker has done all the allocation required
beforehand.
Or else, the DSO can use __attribute__ ((tls_model ("initial-exec"))) for
the variable it wants to use in a signal handler.
Only if those are really not practical in a real-world example should we
consider adding bizarre new features for this corner case.
Thanks,
Roland