On 10/05/2012 04:41 AM, Jakub Jelinek wrote:
Unfortunately, that penalty is not only for thread_local vars with
ctors/dtors.  There is some penalty even for using
extern thread_local int i;
int foo (void)
{
   return i;
}
(as compared to extern __thread int i;), because we have to at least check
whether the weak TLS initializer for i is NULL or not.  Other TU could have
thread_local int i = dynamic_initialization ();

Right. This is why my patch continues to treat thread_local and __thread differently; people that don't want this overhead for exported TLS variables with static initialization can continue to use __thread.

Jason

Reply via email to