开发者

How to get the linux thread id from RWThreadId?

开发者 https://www.devze.com 2023-03-28 00:26 出处:网络
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 (

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消