RFC: TLS problem
Robert Collins
rbcollins@cygwin.com
Fri Aug 2 06:33:00 GMT 2002
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 240 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20020802/ea13ddc4/attachment.sig>
More information about the Cygwin-developers
mailing list