diff options
author | Marc Mutz <[email protected]> | 2025-03-23 17:12:23 +0100 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-06-27 17:21:46 +0200 |
commit | f987e2bcb2be5959b1f80999bfe910d80c80a740 (patch) | |
tree | cecdc1f79a5f24df2576a6672d37a56287e773dd | |
parent | ec24625373c680fd51237b809792e9cd98c792f0 (diff) |
QFactoryLoader: drop libraries mutex sooner
Both QFactoryLoader::metaDataKeys() and QFactoryLoader::metaData()
locked the mutex under QT_CONFIG(library) near the start of the
function and never dropped it until the end of the function.
This is not necessary and, by Amdahl's Law, reduces concurrency.
Drop the mutex before the #endif again.
This isn't as good as splitting the metaDataKeys() loop into one that
extracts the QPluginParsedMetaDatas, dropping the mutex, and then
another doing the JSON work, but it's better than the status quo and
the best the maintainer will accept.
Amends 878e3342e1c9bd8a4da6a2e9e1508dacbe0c7ab6.
Pick-to: 6.10 6.9
Change-Id: Ie69d4a2d20ac02c4331ffcc3f1281caf7cbeb6fe
Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 5fa6cb793d7..54349359113 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -492,6 +492,7 @@ QFactoryLoader::MetaDataList QFactoryLoader::metaData() const QMutexLocker locker(&d->mutex); for (const auto &library : d->libraries) metaData.append(library->metaData); + locker.unlock(); #endif QLatin1StringView iid(d->iid.constData(), d->iid.size()); @@ -518,6 +519,7 @@ QList<QCborArray> QFactoryLoader::metaDataKeys() const const QCborValue md = library->metaData.value(QtPluginMetaDataKeys::MetaData); metaData.append(md["Keys"_L1].toArray()); } + locker.unlock(); #endif QLatin1StringView iid(d->iid.constData(), d->iid.size()); |