Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Hetal last edited by
we are using Qt 5.9.1 in a desktop application. We are logging qApp->thread()->currentThreadId(). I assume that this is the MainThread Id. But, time by time this id is keep changing in the logs.
Is it a Normal case? should this Id keep changing time by time.
JonB last edited by JonB
For a question like this you should always state which platform you are on.
qt5 threadid. There are a number of hits to read, e.g. https://www.qtcentre.org/threads/2369-How-can-I-get-the-thread-ID-out-of-QThread, https://stackoverflow.com/questions/23452218/proper-use-of-qthread-currentthreadid, others also.
Returns the thread handle of the currently executing thread.
Warning: The handle returned by this function is used for internal purposes and should not be used in any application code.
Note: On Windows, this function returns the DWORD (Windows-Thread ID) returned by the Win32 function GetCurrentThreadId(), not the pseudo-HANDLE (Windows-Thread HANDLE) returned by the Win32 function GetCurrentThread().
I imagine your attempted usage/findings are related to this?