Search code examples
linuxqtqthreadqt4.8

setObjectName is not setting the thread name in Qt


I am using Qt 4.8 on Linux. I have the class ZoneManagerThread that inherits the class QThread. In the constructor of this class I am calling the following routine:

this->setObjectName("ZoneManagerThread");

However when I execute ps -eLf I don't see any thread named ZoneManagerThread.

What is the problem here? How can I solve this?


Solution

  • In linux you have a maximum thread length - 16 bytes. Your thread name is 18.

    See: change thread name on linux (htop)

    Can you choose a smaller thread name and re-test ? (in my tests the thread name was truncated... but I worked directly with posix APIs... I am not sure what Qt4 does in this area).