How to get the linux thread id from RWThreadId?
In the RW documentation it advises to use rwThreadHash to get the threadId for debugging but that still doesn't match the actual linux th开发者_如何转开发read id on a thread. Any idea how to get it (not necessarily in a portable way)?
cout << rwThreadHash(threadId()) << endl;
1477159840
I think you are looking for gettid()
From the pthread_self() man page notes: The thread ID returned by pthread_self()
is not the same thing as the kernel thread ID returned by a call to gettid(2). What you are printing out looks like a pthread id.
精彩评论