thread id
hi frnds,
I am new to threads in linux, so for learning threads from begining I have downloaded a tutorial and start working on it. pthread_create() function, requires 4 args, among tht first argument is id of new thread. I have stored tht id into a var t_id (of type pthread_t). Wen I print the t_id, its a 10 digit negative value. I am not surprizing with the 10 digits but wy it is negative ?? as per my knowledge in unix any descriptor is non-negative int values. then wy thread ids are not positive integers ? is there any specific reason ? |
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Posix thread IDs are "integral" (including, but not necessarily limited to, "signed integers"). It's perfectly OK for the high (sign) bit to be set; it's perfectly OK for you to "printf ()" the thread handle ("opaque handle" - *not* a number, certainly not a Unix file descriptor!) with "%u" or "0x%x" if you don't want to see a negative value ("printf()", or whatever equivalent you prefer):
http://publib.boulder.ibm.com/infoce...s/glossary.htm 'Hope that helps .. PSM PS: Why go to the effort to abbreviate "why"? |
All times are GMT -5. The time now is 04:39 PM. |