I was running this program on RHEL 5 with gcc4.1.2. Seems the syscall can give the correct thread id(same like process id), but pthread_self doesn’t give meaningful result. Is it because pthread_self is not portable? Answer If you read man pthread_self, which you should: Thread identifiers should be considered opaque: any attempt to use a thread ID other than in