2006-08-29 08:12:53

by Limeng [李萌]

[permalink] [raw]
Subject: help

Hi,
How can I get one thread’s LWP id on linux?
The thread is not the main thread, so that getpid() does not work. And the LWP id is not the same as the result by pthread_self().

Any suggestion?

Xixi
2006-8-29



2006-08-29 08:46:19

by Erik Mouw

[permalink] [raw]
Subject: [OT] thread identification (was: help)

On Tue, Aug 29, 2006 at 04:12:18PM +0800, Limeng [??????] wrote:
> How can I get one thread???s LWP id on linux???

See gettid(2).

> The thread is not the main thread, so that getpid() does not
> work. And the LWP id is not the same as the result by
> pthread_self().
>
> Any suggestion?

Don't ask it over here, this list is about kernel development, not
about pthread questions.


Erik

--
+-- Erik Mouw -- http://www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

2006-08-29 08:49:40

by Jan Engelhardt

[permalink] [raw]
Subject: Re: help

>Hi,
> How can I get one thread’s LWP id on linux?
> The thread is not the main thread, so that getpid() does not work.
>And the LWP id is not the same as the result by pthread_self().
>
> Any suggestion?

gettid(), I assume.



Jan Engelhardt
--