diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-16 20:48:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-17 12:05:20 +0200 |
commit | 960ad8037275d86f15e0177f52a1d0dac25319e4 (patch) | |
tree | 77199ebd2af9048651e2ea9d6a9fc8dde00f2bdb /svl | |
parent | 137744a25b26d86b9be16a107b3bd011f6ab4b07 (diff) |
osl::Mutex->std::mutex in SharedStringPool
std::mutex is slightly faster
Change-Id: I0741cd1ed0a011d5e8d6099c189c85f50060a326
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119087
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/misc/sharedstringpool.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx index 997648fac363..bcb53c294128 100644 --- a/svl/source/misc/sharedstringpool.cxx +++ b/svl/source/misc/sharedstringpool.cxx @@ -10,8 +10,8 @@ #include <svl/sharedstringpool.hxx> #include <svl/sharedstring.hxx> #include <unotools/charclass.hxx> -#include <osl/mutex.hxx> +#include <mutex> #include <unordered_map> #include <unordered_set> @@ -54,7 +54,7 @@ sal_Int32 getRefCount(const rtl_uString* p) { return (p->refCount & 0x3FFFFFFF); struct SharedStringPool::Impl { - mutable osl::Mutex maMutex; + mutable std::mutex maMutex; // We use this map for two purposes - to store lower->upper case mappings // and to retrieve a shared uppercase object, so the management logic // is quite complex. @@ -77,7 +77,7 @@ SharedStringPool::~SharedStringPool() {} SharedString SharedStringPool::intern(const OUString& rStr) { StringWithHash aStrWithHash(rStr); - osl::MutexGuard aGuard(&mpImpl->maMutex); + std::lock_guard<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() { - osl::MutexGuard aGuard(&mpImpl->maMutex); + std::lock_guard<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 { - osl::MutexGuard aGuard(&mpImpl->maMutex); + std::lock_guard<std::mutex> aGuard(mpImpl->maMutex); return mpImpl->maStrMap.size(); } size_t SharedStringPool::getCountIgnoreCase() const { - osl::MutexGuard aGuard(&mpImpl->maMutex); + std::lock_guard<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) |