[Libreoffice-commits] core.git: stoc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 2 06:37:35 UTC 2021


 stoc/source/corereflection/lrucache.hxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit e98f04cedff85fd6a355a67cabd507782e2f693b
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Aug 1 18:56:59 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 2 08:37:00 2021 +0200

    osl::Mutex->std::mutex in LRU_Cache
    
    Change-Id: Ia84cef550412540aa511f917198712add32fc7ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119831
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx
index 4ed99eaa77b0..c004d605485a 100644
--- a/stoc/source/corereflection/lrucache.hxx
+++ b/stoc/source/corereflection/lrucache.hxx
@@ -22,10 +22,10 @@
 // __CACHE_DIAGNOSE forces cache size to 4 and works only for OUString keys
 //  #define __CACHE_DIAGNOSE 1
 
-#include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
 
 #include <memory>
+#include <mutex>
 #include <unordered_map>
 
 namespace com::sun::star::uno { class Any; }
@@ -45,7 +45,7 @@ class LRU_Cache
     };
     typedef std::unordered_map< t_Key, CacheEntry *, t_KeyHash > t_Key2Element;
 
-    mutable ::osl::Mutex        _aCacheMutex;
+    mutable std::mutex        _aCacheMutex;
     sal_Int32                   _nCachedElements;
     t_Key2Element               _aKey2Element;
 
@@ -126,7 +126,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::toFront( CacheEntry * pEntry )
 template< class t_Key, class t_Val, class t_KeyHash >
 inline t_Val LRU_Cache< t_Key, t_Val, t_KeyHash >::getValue( const t_Key & rKey ) const
 {
-    ::osl::MutexGuard aGuard( _aCacheMutex );
+    std::lock_guard aGuard( _aCacheMutex );
     const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) );
     if (iFind != _aKey2Element.end())
     {
@@ -146,7 +146,7 @@ template< class t_Key, class t_Val, class t_KeyHash >
 inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::setValue(
     const t_Key & rKey, const t_Val & rValue )
 {
-    ::osl::MutexGuard aGuard( _aCacheMutex );
+    std::lock_guard aGuard( _aCacheMutex );
     if (_nCachedElements > 0)
     {
         const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) );
@@ -184,7 +184,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::setValue(
 template< class t_Key, class t_Val, class t_KeyHash >
 inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::clear()
 {
-    ::osl::MutexGuard aGuard( _aCacheMutex );
+    std::lock_guard aGuard( _aCacheMutex );
     _aKey2Element.clear();
     for ( sal_Int32 nPos = _nCachedElements; nPos--; )
     {


More information about the Libreoffice-commits mailing list