diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-05-09 17:55:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-10 08:13:40 +0200 |
commit | 63a2f314250b05d484747fafc4a814a4553f461e (patch) | |
tree | f456e5b1985522b01c18fedc46b078802140ae0a | |
parent | 3ce14653edd9a7f845f81d9e727b5031a3349291 (diff) |
osl::Mutex->std::mutex in HierarchyEntry
Several methods actually do not need locking because they are
calling other methods which are already locked, and thereafter
they touch only function-local state.
Change-Id: Ic0c55df65988fcc64899a31586f6a426825cba81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134088
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchydata.cxx | 17 | ||||
-rw-r--r-- | ucb/source/ucp/hierarchy/hierarchydata.hxx | 4 |
2 files changed, 7 insertions, 14 deletions
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx index bbdde5c2d1ff..3e802a4fd53d 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx @@ -123,7 +123,6 @@ HierarchyEntry::HierarchyEntry( bool HierarchyEntry::hasData() { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); uno::Reference< container::XHierarchicalNameAccess > xRootReadAccess = getRootReadAccess(); @@ -140,8 +139,6 @@ bool HierarchyEntry::getData( HierarchyEntryData& rData ) { try { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - uno::Reference< container::XHierarchicalNameAccess > xRootReadAccess = getRootReadAccess(); @@ -242,7 +239,7 @@ bool HierarchyEntry::setData( const HierarchyEntryData& rData ) { try { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !m_xConfigProvider.is() ) m_xConfigProvider.set( @@ -454,10 +451,10 @@ bool HierarchyEntry::setData( const HierarchyEntryData& rData ) bool HierarchyEntry::move( const OUString& rNewURL, const HierarchyEntryData& rData ) { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - OUString aNewPath = createPathFromHierarchyURL( HierarchyUri(rNewURL) ); + std::unique_lock aGuard( m_aMutex ); + if ( aNewPath == m_aPath ) return true; @@ -736,7 +733,7 @@ bool HierarchyEntry::remove() { try { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !m_xConfigProvider.is() ) m_xConfigProvider.set( @@ -844,8 +841,6 @@ bool HierarchyEntry::remove() bool HierarchyEntry::first( iterator & it ) { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - if ( it.pos == -1 ) { // Init... @@ -912,8 +907,6 @@ bool HierarchyEntry::first( iterator & it ) bool HierarchyEntry::next( iterator& it ) { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - if ( it.pos == -1 ) return first( it ); @@ -972,7 +965,7 @@ HierarchyEntry::getRootReadAccess() { if ( !m_xRootReadAccess.is() ) { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !m_xRootReadAccess.is() ) { if ( m_bTriedToGetRootReadAccess ) diff --git a/ucb/source/ucp/hierarchy/hierarchydata.hxx b/ucb/source/ucp/hierarchy/hierarchydata.hxx index 34e24cdb6c35..e81364243d31 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.hxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.hxx @@ -20,9 +20,9 @@ #pragma once #include <rtl/ustring.hxx> -#include <osl/mutex.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <mutex> namespace com::sun::star { namespace container { @@ -77,7 +77,7 @@ class HierarchyEntry OUString m_aServiceSpecifier; OUString m_aName; OUString m_aPath; - ::osl::Mutex m_aMutex; + std::mutex m_aMutex; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; css::uno::Reference< css::container::XHierarchicalNameAccess > |