History

name all the threads

HifiExperiments committed 5 years ago

Commit 30c47791 parent c86955419 files · +85 −25Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 19 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+7−3
@@ -87,7 +87,7 @@ · 86 unmodified lines
8787 #include "SettingHandle.h"
8888 #include <AddressManager.h>
8989 #include <NetworkingConstants.h>
90−
90+#include <ThreadHelpers.h>
9191
9292 const QString ScriptEngine::_SETTINGS_ENABLE_EXTENDED_EXCEPTIONS {
9393 "com.highfidelity.experimental.enableExtendedJSExceptions"
@@ -429,13 +429,17 @@ void ScriptEngine::runInThread() { · 335 unmodified lines
429429 // The thread interface cannot live on itself, and we want to move this into the thread, so
430430 // the thread cannot have this as a parent.
431431 QThread* workerThread = new QThread();
432− workerThread->setObjectName(QString("js:") + getFilename().replace("about:",""));
432+ QString name = QString("js:") + getFilename().replace("about:","");
433+ workerThread->setObjectName(name);
433434 moveToThread(workerThread);
434435
435436 // NOTE: If you connect any essential signals for proper shutdown or cleanup of
436437 // the script engine, make sure to add code to "reconnect" them to the
437438 // disconnectNonEssentialSignals() method
438− connect(workerThread, &QThread::started, this, &ScriptEngine::run);
439+ connect(workerThread, &QThread::started, this, [this, name] {
440+ setThreadName(name.toStdString());
441+ run();
442+ });
439443 connect(this, &QObject::destroyed, workerThread, &QThread::quit);
440444 connect(workerThread, &QThread::finished, workerThread, &QObject::deleteLater);
441445