Re: [patch] threading fix, tid-2.5.47-A3

Luca Barbieri (ldb@ldb.ods.org)
18 Nov 2002 09:07:11 +0100


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

> - please don't introduce a new pointer, just use the old one. There=20
> appears to be no cases where you want to have different pointers
> anyway.
There are: suppose that you want to implement the int cfork(int* pid)
function, which returns the pid in *pid in the parent vm, in a
multithreaded application.

The child tid pointer must be set to the current thread tid field,
because the thread structure is going to be reused.

However, that field contains the tid of the forking thread in the parent
process and must not be modified. So a different pointer is needed.

You could avoid the additional pointer by letting
child_tidptr =3D (!(flags & CLONE_VM) && current->user_tid) ?
current->user_tid : parent_tidptr;

but this forces the thread library to reuse the thread structure when
forking.

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA92J+vdjkty3ft5+cRAux4AJ9r4jfiWTT0cN2iK3tpAc2XrOfKJwCg0BXv
r1WAK7VtjtHlpHnTsc7ie0U=
=LsSD
-----END PGP SIGNATURE-----

--=-NLJzUcp03C6g7I4U5Gzl--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/