开发者

how to print correctly the handling thread on Windows?

开发者 https://www.devze.com 2022-12-24 13:34 出处:网络
Could someone please tell us on how to print correc开发者_如何学运维tly the handling thread in windows? Actually I tried several ways but it doesn\'t return the right number as in Unix-variant, as suc

Could someone please tell us on how to print correc开发者_如何学运维tly the handling thread in windows? Actually I tried several ways but it doesn't return the right number as in Unix-variant, as such e.g.:

cout << " with thread " << pthread_self << endl;
cout << " with thread " << pthread_self().p << endl;

Thanks for your replies:


GetCurrentThread returns a "pseudohandle", not a valid thread handle. You should use "GetCurrentThreadId" instead (or ::GetCurrentThreadId()), and include windows.h, of course.


You mean current thread handle in Windows ?

GetCurrentThread()

0

精彩评论

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