Ups,

thanks for this advice. I missed that part in the documentation.

Sometime it is quite useful to check the manual - even for 'trivial' APIs such as get--Id()

But, at the end I'm completely confused I realized that the thread ID - as provided by QThread::getThreadId() - is not a unique Id/number that is qualified to identify and manage threads on application level, because:
  • it can't be handed over from one thread context to another
  • it can't be handed over from one thread context to another
  • it doesn't uniquely identify running treads by different threads, which would require a numerical comparison of the ID/Handle.
  • even printing in log statements wouldn't be unique and portable (because of different typedefs).
  • it isn't possible to recreate/get a specific QThread object based on a ID/Handle

I guess (hope) I'm wrong with this assumption.

Quote Originally Posted by iGoo
If so,it behaves as windows api
HANDLE GetCurrentThread(VOID);
you can then call DuplicateHandle to thanslate it to real id.
refer MSDN for dedails.
I would like not to descent to such platform specific features in application code. Actually, this is one (good) reason to use QT But, Thanks anyway.