How to change the name of thread in thread pool
-
Hi all
I want to change the name of the thread run in the global thread pool. But I know we could only change it by
setobjectName()
before the thread started.Now I have some ways to create threads:
QThreadPool::globalInstance()->start()
QtConcurrent::run()
So is there any other way to change that?
BTW, I know
QThread
but I don't want to move a function to be a class, also it will not be transfered frequently.Best regards
Mihan -
Hi all
I want to change the name of the thread run in the global thread pool. But I know we could only change it by
setobjectName()
before the thread started.Now I have some ways to create threads:
QThreadPool::globalInstance()->start()
QtConcurrent::run()
So is there any other way to change that?
BTW, I know
QThread
but I don't want to move a function to be a class, also it will not be transfered frequently.Best regards
Mihan@Mihan what exactly do you want to do?
"Thread names" I only know from Java, not c++.
Well, there's also this
https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2022But I don't think that is covered by the Qt API, seems like a very OS specific use case.
-
M Mihan has marked this topic as solved on