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()
精彩评论