On Sunday 27 October 2013 04:53:41 Jiergir Ogoerg wrote:
> It looks like only the home and temp dir paths are worth caching, their
> window$ implementation is ~ 30-40 lines of code
> if counting QDir's subcalls to QFileSystemEngine.
>
> For these two QDir functions to stay one liners and lock-less (while thread
> safe), I'm caching the paths in QDirPrivate
> (QTSRC/qtbase/src/corelib/io/qdir_p.h and
> QTSRC/qtbase/src/corelib/io/qdir.cpp),
Don't use global static QStrings. (they have a constructor that is run at load
time of the library, we don't allow that within Qt)
Use the Q_GLOBAL_STATIC macro.
Something like this:
Q_GLOBAL_STATIC_WITH_ARGS(QString, homePath, (QFileSystemEngine::homePath()));
QString QDir::homePath()
{
return homePath();
}
--
Olivier
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development