Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: Thomas Pfaff Cc: cygwin-developers AT cygwin DOT com In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-cQWCQV3n93WQYm39hZ0G" 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--