This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin 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: RFC: TLS problem


On Fri, 2002-08-02 at 23:20, Thomas Pfaff wrote:
> 


> The forked child will not inherit the alloced TLS from the parent because
> this is not implemented by the runtime, but it will still use the
> inherited keys  ?

No. 

pthread_key.dwTlsIndex is invalidated by fork().

so we add a field to pthread_key:
void *savedValue;

before fork() we:
savedValue = get();

after fork() we:
dwTlsIndex = TlsAlloc ();
  if (dwTlsIndex == TLS_OUT_OF_INDEXES)
    apifatal ("Could not re-establish TLS index for pthread_key %p\n",
this);
set (savedValue);

> Sounds strange IMHO.
> How will you make sure that you will get the same slot for your TLS
> values when TlsAlloc will return random numbers (the first free one) ?

Who cares? The pthread_key interface does not expose the TLS index.

Rob

Attachment: signature.asc
Description: This is a digitally signed message part


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