diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-21 17:40:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-01 13:14:06 +0100 |
commit | 34b67c5cb3338c4bd72f42df99a4b79ca1588071 (patch) | |
tree | e9891f1299213fb69ff71653f14e9bf850ef1a42 /sw | |
parent | 1bb248fa3670ac11d4623ba14d1e914554fb6971 (diff) |
osl::Mutex->std::mutex in SwRetrievedInputStreamDataManager
drop the locking call in
IMPL_LINK( SwRetrievedInputStreamDataManager, LinkedInputStreamReady
because it doesn't actually touch any related data and the lock
is taken in the call to PopData.
Change-Id: I2e679b97a1ce36e7d39a9a2818a9d62fd53009a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127812
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/retrievedinputstreamdata.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/inc/retrievedinputstreamdata.hxx | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/sw/source/core/docnode/retrievedinputstreamdata.cxx b/sw/source/core/docnode/retrievedinputstreamdata.cxx index 5612096c1fc4..311be07ca719 100644 --- a/sw/source/core/docnode/retrievedinputstreamdata.cxx +++ b/sw/source/core/docnode/retrievedinputstreamdata.cxx @@ -34,7 +34,7 @@ SwRetrievedInputStreamDataManager& SwRetrievedInputStreamDataManager::GetManager SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::ReserveData( std::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > const & pThreadConsumer ) { - osl::MutexGuard aGuard(maMutex); + std::unique_lock aGuard(maMutex); // create empty data container for given thread Consumer tDataKey nDataKey( snNextKeyValue ); @@ -59,7 +59,7 @@ void SwRetrievedInputStreamDataManager::PushData( css::uno::Reference<css::io::XInputStream> const & xInputStream, const bool bIsStreamReadOnly ) { - osl::MutexGuard aGuard(maMutex); + std::unique_lock aGuard(maMutex); std::map< tDataKey, tData >::iterator aIter = maInputStreamData.find( nDataKey ); @@ -88,7 +88,7 @@ void SwRetrievedInputStreamDataManager::PushData( bool SwRetrievedInputStreamDataManager::PopData( const tDataKey nDataKey, tData& rData ) { - osl::MutexGuard aGuard(maMutex); + std::unique_lock aGuard(maMutex); bool bDataProvided( false ); @@ -115,9 +115,8 @@ bool SwRetrievedInputStreamDataManager::PopData( const tDataKey nDataKey, #i73788# Note: This method has to be run in the main thread. */ -IMPL_LINK( SwRetrievedInputStreamDataManager, - LinkedInputStreamReady, - void*, p, void ) +IMPL_STATIC_LINK( SwRetrievedInputStreamDataManager, LinkedInputStreamReady, + void*, p, void ) { SwRetrievedInputStreamDataManager::tDataKey* pDataKey = static_cast<SwRetrievedInputStreamDataManager::tDataKey*>(p); if ( !pDataKey ) @@ -125,8 +124,6 @@ IMPL_LINK( SwRetrievedInputStreamDataManager, return; } - osl::MutexGuard aGuard(maMutex); - SwRetrievedInputStreamDataManager& rDataManager = SwRetrievedInputStreamDataManager::GetManager(); SwRetrievedInputStreamDataManager::tData aInputStreamData; diff --git a/sw/source/core/inc/retrievedinputstreamdata.hxx b/sw/source/core/inc/retrievedinputstreamdata.hxx index 153bab8b1a0b..4a958b31bf19 100644 --- a/sw/source/core/inc/retrievedinputstreamdata.hxx +++ b/sw/source/core/inc/retrievedinputstreamdata.hxx @@ -21,7 +21,7 @@ #include <tools/link.hxx> #include <sal/types.h> -#include <osl/mutex.hxx> +#include <mutex> #include <com/sun/star/uno/Reference.hxx> #include <map> @@ -74,13 +74,13 @@ class SwRetrievedInputStreamDataManager bool PopData( const tDataKey nDataKey, tData& rData ); - DECL_LINK( LinkedInputStreamReady, void*, void ); + DECL_STATIC_LINK( SwRetrievedInputStreamDataManager, LinkedInputStreamReady, void*, void ); private: static tDataKey snNextKeyValue; - osl::Mutex maMutex; + std::mutex maMutex; std::map< tDataKey, tData > maInputStreamData; }; |