How to print the thread id using qDebug()
on windows environment of Qt
.
I'm assuming you want the thread id of the currently executing thread (and not the thread id of a specific QThread object):
qDebug() << QThread::currentThreadId();
Things to consider: The method returns a platform specific id (check the docs). In windows you cannot use this id with Win32 API functions since it returns a pseudo id and not the real thread id.
If your application will only run in Windows and you need to do something meaningful with the thread id it would probably be best if you used GetCurrentThreadId().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With