Re: Thread_Id

From: Arjan van de Ven
Date: Tue Jul 05 2005 - 08:04:45 EST


On Tue, 2005-07-05 at 17:45 +0530, RVK wrote:
> Can anyone suggest me how to get the threadId using 2.6.x kernels.
> pthread_self() does not work and returns some -ve integer.

NAME
pthread_self - get the calling thread ID

SYNOPSIS
#include <pthread.h>

pthread_t pthread_self(void);

DESCRIPTION
The pthread_self() function shall return the thread ID of the
calling thread.




pthread_self() works just fine for me. But... what makes you think a
"negative" value is a failure? What interpretation are you giving to
thread ID that negative woudl be wrong? A pthreads thread ID is just a
cookie you only can use to give back to the pthread library functions in
places where it's needed...


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