Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Jun 2010 21:16:28 +0200
From:      =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= <v.haisman@sh.cvut.cz>
To:        freebsd-hackers@freebsd.org
Subject:   Re: How to get a thread ID?
Message-ID:  <4C07FF8C.1090800@sh.cvut.cz>
In-Reply-To: <20100603151915.GI83316@deviant.kiev.zoral.com.ua>
References:  <6e716c850fa84621482b71826dae55d5@shell.sh.cvut.cz>	<20100603144452.GC85961@dan.emsphone.com> <20100603151915.GI83316@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigDF6A748632350A2092CB5F17
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Kostik Belousov wrote, On 3.6.2010 17:19:
> On Thu, Jun 03, 2010 at 09:44:52AM -0500, Dan Nelson wrote:
>> In the last episode (Jun 03), V??clav Haisman said:
>>> is it possible to obtain some sort of a thread ID that identifies a t=
hread
>>> within a process other than pthread_self()?  Something like gettid() =
on
>>> Linux?  Apparently, on FreeBSD the pthread_t is a pointer type and do=
es
>>> not identify the thread well enough.  GDB on FreeBSD seems to know ab=
out
>>> threads and does not seem to use the same ID as is pthread_t.
>>
>> The return value of pthread_self() is a pointer to the (private) "stru=
ct
>> pthread" for the current thread, and should uniquely identify a thread=
=2E  Do
>> you have a testcase that shows otherwise?  GDB might just enumerate th=
e
>> currently active threads starting from 1.
>=20
> There is thr_self(2) undocumented syscall:
> int thr_self(long *id);
Thanks, I'll try it. Is the returned ID the LWP ID that GDB shows?

--
VH


--------------enigDF6A748632350A2092CB5F17
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREIAAYFAkwH/4wACgkQr2CghdezFMlsxwCgg9LhvOwppMs6TawP3QKvyjmF
hUgAnjGjMRXzvxEjccqXpAmUYE0Muu/D
=qw+X
-----END PGP SIGNATURE-----

--------------enigDF6A748632350A2092CB5F17--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C07FF8C.1090800>