diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 11:36:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 12:20:53 +0200 |
commit | 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch) | |
tree | 5830c7ee2442984e0bc804def7bd95ddd8a25410 /svl/source/misc | |
parent | 5afdcad4c0e7850b18996c549892b9360cd8973f (diff) |
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/misc')
-rw-r--r-- | svl/source/misc/sharedstringpool.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx index bcb53c294128..2fe8fd8a13ff 100644 --- a/svl/source/misc/sharedstringpool.cxx +++ b/svl/source/misc/sharedstringpool.cxx @@ -77,7 +77,7 @@ SharedStringPool::~SharedStringPool() {} SharedString SharedStringPool::intern(const OUString& rStr) { StringWithHash aStrWithHash(rStr); - std::lock_guard<std::mutex> aGuard(mpImpl->maMutex); + std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex); auto[mapIt, bInserted] = mpImpl->maStrMap.emplace(aStrWithHash, rStr); if (!bInserted) @@ -112,7 +112,7 @@ SharedString SharedStringPool::intern(const OUString& rStr) void SharedStringPool::purge() { - std::lock_guard<std::mutex> aGuard(mpImpl->maMutex); + std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex); // Because we can have an uppercase entry mapped to itself, // and then a bunch of lowercase entries mapped to that same @@ -163,13 +163,13 @@ void SharedStringPool::purge() size_t SharedStringPool::getCount() const { - std::lock_guard<std::mutex> aGuard(mpImpl->maMutex); + std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex); return mpImpl->maStrMap.size(); } size_t SharedStringPool::getCountIgnoreCase() const { - std::lock_guard<std::mutex> aGuard(mpImpl->maMutex); + std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex); // this is only called from unit tests, so no need to be efficient std::unordered_set<OUString> aUpperSet; for (auto const& pair : mpImpl->maStrMap) |