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 | |
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')
-rw-r--r-- | svl/source/config/itemholder2.cxx | 4 | ||||
-rw-r--r-- | svl/source/misc/sharedstringpool.cxx | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index 4bcbe13c5c7c..7ad7f4c62ba1 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -75,7 +75,7 @@ void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&) void ItemHolder2::impl_addItem(EItem eItem) { - std::lock_guard aLock(m_aLock); + std::scoped_lock aLock(m_aLock); for ( auto const & rInfo : m_lItems ) { @@ -94,7 +94,7 @@ void ItemHolder2::impl_releaseAllItems() { std::vector< TItemInfo > items; { - std::lock_guard aLock(m_aLock); + std::scoped_lock aLock(m_aLock); items.swap(m_lItems); } 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) |