delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/08/02/09:33:57

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Subject: Re: RFC: TLS problem
From: Robert Collins <rbcollins AT cygwin DOT com>
To: Thomas Pfaff <tpfaff AT gmx DOT net>
Cc: cygwin-developers AT cygwin DOT com
In-Reply-To: <Pine.WNT.4.44.0208021511120.297-100000@algeria.intern.net>
References: <Pine DOT WNT DOT 4 DOT 44 DOT 0208021511120 DOT 297-100000 AT algeria DOT intern DOT net>
Date: 02 Aug 2002 23:33:52 +1000
Message-Id: <1028295232.8690.58.camel@lifelesswks>
Mime-Version: 1.0

--=-cQWCQV3n93WQYm39hZ0G
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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


> 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.=20

pthread_key.dwTlsIndex is invalidated by fork().

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

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

after fork() we:
dwTlsIndex =3D TlsAlloc ();
  if (dwTlsIndex =3D=3D 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


--=-cQWCQV3n93WQYm39hZ0G
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEUEABECAAYFAj1Kij8ACgkQI5+kQ8LJcoJXjACY4K9cXCME+rV9k6eWFKhVWO3u
uQCcD35VWFTPDDl16FxhDOsYaAvx2Qg=
=KNhO
-----END PGP SIGNATURE-----

--=-cQWCQV3n93WQYm39hZ0G--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019