Avoid an expensive call to toLocal8Bit upon thread creation
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 15 Aug 2012 16:03:50 +0000 (18:03 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Aug 2012 21:40:57 +0000 (23:40 +0200)
commit3ef51efbe75bfb9f1dfbe7df073e9eb745a72ad8
tree0778012c6ea10341eba46b0f30b22b95b73fa207
parent03b95247a1bef127e3de7a00778f52a37009edf0
Avoid an expensive call to toLocal8Bit upon thread creation

QString::toLocal8Bit() will need to call QTextCodec::codecForLocale(),
which isn't the cheapest of the functions, at least the first time it's
run. So avoid calling it when in most scenarios, the name of the QObject
isn't set, and the information is purely for debugging.

Additionally, avoid allocating memory when setting the thread name to
the class name. The class name coming from the meta object is a static
constant string and we can use it directly.

Change-Id: Ief643bad87a51487b1d41c0a2f323e80bb53e8a7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
src/corelib/thread/qthread_unix.cpp