This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Async signal safe TLS accesses


On 12/05/2013 03:01 PM, Andrew Hunter wrote:
>> You could use a futex to block until *pp != TLS_DTV_UNALLOCATED.  If
>> this is a one-shot transition (ie, like in a latch), then this should be
>> simple and would just need a suitable futex wake operation elsewhere.
>>
>> However, the pure spin-wait is probably fine unless we want to support
>> programs with real-time priorities (ie, where a higher-prio thread could
>> starve a lower-prio thread forever, for example, if the former is
>> spin-waiting for a result produced by the latter).  I don't know whether
>> we do or do not want to support that, so I'm leaving that to others to
>> decide.
>>
> 
> This case can only occur (I believe) when we have:
> 
> dlopen(L1) (contains TLS variable x)
> 
> Thread T1 reads x and goes to dynamically initialize it, racing with...
> Thread T2 dlopen(L2) (contains tls reloc referencing x from L1)
> 
> which is at best extremely obscure; I would prefer to avoid the
> complexity of futex unless we really see this as a priority.

It is not a priority. We can optimize this in future revisions.

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]