summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-03 11:36:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-03 12:20:53 +0200
commit05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch)
tree5830c7ee2442984e0bc804def7bd95ddd8a25410
parent5afdcad4c0e7850b18996c549892b9360cd8973f (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>
-rw-r--r--binaryurp/source/outgoingrequests.cxx6
-rw-r--r--bridges/source/cpp_uno/shared/vtablefactory.cxx4
-rw-r--r--canvas/source/factory/cf_service.cxx2
-rw-r--r--comphelper/source/container/namecontainer.cxx14
-rw-r--r--comphelper/source/misc/accessiblekeybindinghelper.cxx8
-rw-r--r--comphelper/source/misc/asyncnotification.cxx6
-rw-r--r--comphelper/source/streaming/oslfile2streamwrap.cxx6
-rw-r--r--comphelper/source/streaming/seekableinput.cxx16
-rw-r--r--comphelper/source/streaming/seqinputstreamserv.cxx18
-rw-r--r--comphelper/source/streaming/seqoutputstreamserv.cxx8
-rw-r--r--comphelper/source/streaming/seqstream.cxx20
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx2
-rw-r--r--cppu/source/uno/EnvStack.cxx4
-rw-r--r--cppu/source/uno/lbmap.cxx4
-rw-r--r--cppuhelper/source/implbase_ex.cxx2
-rw-r--r--cppuhelper/source/propertysetmixin.cxx12
-rw-r--r--cppuhelper/source/servicemanager.cxx4
-rw-r--r--cppuhelper/source/typemanager.cxx2
-rw-r--r--eventattacher/source/eventattacher.cxx16
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx34
-rw-r--r--framework/source/services/dispatchhelper.cxx8
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx4
-rw-r--r--i18npool/source/numberformatcode/numberformatcode.cxx8
-rw-r--r--lingucomponent/source/languageguessing/guesslang.cxx12
-rw-r--r--lingucomponent/source/numbertext/numbertext.cxx4
-rw-r--r--linguistic/source/misc.cxx4
-rw-r--r--oox/source/core/filterbase.cxx4
-rw-r--r--oox/source/helper/propertymap.cxx2
-rw-r--r--package/source/xstor/disposelistener.cxx4
-rw-r--r--package/source/xstor/switchpersistencestream.cxx28
-rw-r--r--package/source/zipapi/ByteGrabber.cxx14
-rw-r--r--package/source/zipapi/blowfishcontext.cxx4
-rw-r--r--package/source/zipapi/sha1context.cxx8
-rw-r--r--sax/source/fastparser/fastparser.cxx6
-rw-r--r--sc/source/core/data/mtvelements.cxx4
-rw-r--r--sc/source/core/data/poolhelp.cxx2
-rw-r--r--sc/source/core/tool/editutil.cxx2
-rw-r--r--sc/source/core/tool/refreshtimer.cxx4
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx2
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx2
-rw-r--r--scripting/source/provider/ProviderCache.cxx6
-rw-r--r--sd/source/ui/framework/configuration/ResourceFactoryManager.cxx8
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx2
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.cxx2
-rw-r--r--sdext/source/presenter/PresenterTimer.cxx20
-rw-r--r--sfx2/source/control/thumbnailviewacc.cxx6
-rw-r--r--sfx2/source/doc/doctemplates.cxx2
-rw-r--r--slideshow/source/engine/eventqueue.cxx16
-rw-r--r--sot/source/sdstor/ucbstorage.cxx14
-rw-r--r--stoc/source/corereflection/lrucache.hxx6
-rw-r--r--stoc/source/javavm/interact.cxx4
-rw-r--r--stoc/source/namingservice/namingservice.cxx6
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx8
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx66
-rw-r--r--svl/source/config/itemholder2.cxx4
-rw-r--r--svl/source/misc/sharedstringpool.cxx8
-rw-r--r--svtools/source/config/itemholder2.cxx4
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx6
-rw-r--r--svtools/source/control/asynclink.cxx6
-rw-r--r--svtools/source/control/inettbc.cxx10
-rw-r--r--svtools/source/control/valueacc.cxx6
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx6
-rw-r--r--svx/source/form/ParseContext.cxx4
-rw-r--r--svx/source/form/fmtools.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrprimitivetools.cxx2
-rw-r--r--svx/source/xml/xmleohlp.cxx6
-rw-r--r--sw/source/core/access/acccell.cxx4
-rw-r--r--sw/source/core/access/acccontext.cxx18
-rw-r--r--sw/source/core/access/accframebase.cxx6
-rw-r--r--sw/source/core/access/accpage.cxx6
-rw-r--r--sw/source/core/access/accpara.cxx14
-rw-r--r--sw/source/core/docnode/finalthreadmanager.cxx12
-rw-r--r--unotools/source/accessibility/accessiblerelationsethelper.cxx10
-rw-r--r--unotools/source/accessibility/accessiblestatesethelper.cxx12
-rw-r--r--unotools/source/config/itemholder1.cxx4
-rw-r--r--unotools/source/i18n/charclass.cxx40
-rw-r--r--unotools/source/i18n/textsearch.cxx2
-rw-r--r--unotools/source/streaming/streamhelper.cxx12
-rw-r--r--unotools/source/streaming/streamwrap.cxx14
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx8
-rw-r--r--unoxml/source/dom/documentbuilder.cxx12
-rw-r--r--unoxml/source/dom/saxbuilder.cxx28
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx52
-rw-r--r--unoxml/source/xpath/xpathapi.cxx10
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx4
-rw-r--r--vcl/source/filter/graphicfilter.cxx4
-rw-r--r--vcl/source/graphic/UnoGraphicObject.cxx4
-rw-r--r--vcl/source/helper/displayconnectiondispatch.cxx8
-rw-r--r--vcl/source/treelist/transfer2.cxx4
-rw-r--r--vcl/source/window/dndeventdispatcher.cxx12
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx14
-rw-r--r--xmlhelp/source/treeview/tvread.cxx2
-rw-r--r--xmloff/source/core/xmlexp.cxx2
-rw-r--r--xmlscript/source/xmlflat_imexp/xmlbas_export.cxx8
-rw-r--r--xmlsecurity/source/xmlsec/nss/digestcontext.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx2
97 files changed, 439 insertions, 439 deletions
diff --git a/binaryurp/source/outgoingrequests.cxx b/binaryurp/source/outgoingrequests.cxx
index ed15e5a1bda8..3cdc80e82bb2 100644
--- a/binaryurp/source/outgoingrequests.cxx
+++ b/binaryurp/source/outgoingrequests.cxx
@@ -37,12 +37,12 @@ OutgoingRequests::~OutgoingRequests() {}
void OutgoingRequests::push(
rtl::ByteSequence const & tid, OutgoingRequest const & request)
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
map_[tid].push_back(request);
}
OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
Map::iterator i(map_.find(tid));
if (i == map_.end()) {
throw css::uno::RuntimeException(
@@ -53,7 +53,7 @@ OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
}
void OutgoingRequests::pop(rtl::ByteSequence const & tid) noexcept {
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
Map::iterator i(map_.find(tid));
assert(i != map_.end());
i->second.pop_back();
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index a74d75ed1f28..a8aa7a9c2bfa 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -214,7 +214,7 @@ VtableFactory::VtableFactory(): m_arena(
VtableFactory::~VtableFactory() {
{
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
for (const auto& rEntry : m_map) {
for (sal_Int32 j = 0; j < rEntry.second.count; ++j) {
freeBlock(rEntry.second.blocks[j]);
@@ -228,7 +228,7 @@ const VtableFactory::Vtables& VtableFactory::getVtables(
typelib_InterfaceTypeDescription * type)
{
OUString name(type->aBase.pTypeName);
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
Map::iterator i(m_map.find(name));
if (i == m_map.end()) {
GuardedBlocks blocks(*this);
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 6919d56fb219..8f16ce0db008 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -288,7 +288,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
OUString const & serviceName, Sequence<Any> const & args,
Reference<XComponentContext> const & xContext ) const
{
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
// forcing last entry from impl list, if config flag set
bool bForceLastEntry(false);
diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx
index d175d25c3b37..c13ee7486e80 100644
--- a/comphelper/source/container/namecontainer.cxx
+++ b/comphelper/source/container/namecontainer.cxx
@@ -80,7 +80,7 @@ NameContainer::NameContainer( const css::uno::Type& aType )
// XNameContainer
void SAL_CALL NameContainer::insertByName( const OUString& aName, const Any& aElement )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( maProperties.find( aName ) != maProperties.end() )
throw ElementExistException();
@@ -93,7 +93,7 @@ void SAL_CALL NameContainer::insertByName( const OUString& aName, const Any& aEl
void SAL_CALL NameContainer::removeByName( const OUString& Name )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( Name );
if( aIter == maProperties.end() )
@@ -106,7 +106,7 @@ void SAL_CALL NameContainer::removeByName( const OUString& Name )
void SAL_CALL NameContainer::replaceByName( const OUString& aName, const Any& aElement )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter( maProperties.find( aName ) );
if( aIter == maProperties.end() )
@@ -122,7 +122,7 @@ void SAL_CALL NameContainer::replaceByName( const OUString& aName, const Any& aE
Any SAL_CALL NameContainer::getByName( const OUString& aName )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( aName );
if( aIter == maProperties.end() )
@@ -133,14 +133,14 @@ Any SAL_CALL NameContainer::getByName( const OUString& aName )
Sequence< OUString > SAL_CALL NameContainer::getElementNames( )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( aName );
return aIter != maProperties.end();
@@ -148,7 +148,7 @@ sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
sal_Bool SAL_CALL NameContainer::hasElements( )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return !maProperties.empty();
}
diff --git a/comphelper/source/misc/accessiblekeybindinghelper.cxx b/comphelper/source/misc/accessiblekeybindinghelper.cxx
index c30cb3307d48..cf16f157c5e3 100644
--- a/comphelper/source/misc/accessiblekeybindinghelper.cxx
+++ b/comphelper/source/misc/accessiblekeybindinghelper.cxx
@@ -55,7 +55,7 @@ namespace comphelper
void OAccessibleKeyBindingHelper::AddKeyBinding( const Sequence< awt::KeyStroke >& rKeyBinding )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aKeyBindings.push_back( rKeyBinding );
}
@@ -63,7 +63,7 @@ namespace comphelper
void OAccessibleKeyBindingHelper::AddKeyBinding( const awt::KeyStroke& rKeyStroke )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aKeyBindings.push_back( { rKeyStroke } );
}
@@ -73,7 +73,7 @@ namespace comphelper
sal_Int32 OAccessibleKeyBindingHelper::getAccessibleKeyBindingCount()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_aKeyBindings.size();
}
@@ -81,7 +81,7 @@ namespace comphelper
Sequence< awt::KeyStroke > OAccessibleKeyBindingHelper::getAccessibleKeyBinding( sal_Int32 nIndex )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( nIndex < 0 || nIndex >= static_cast<sal_Int32>(m_aKeyBindings.size()) )
throw IndexOutOfBoundsException();
diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx
index 1a33c5a0b331..0c7f6391db8b 100644
--- a/comphelper/source/misc/asyncnotification.cxx
+++ b/comphelper/source/misc/asyncnotification.cxx
@@ -88,7 +88,7 @@ namespace comphelper
void AsyncEventNotifierBase::removeEventsForProcessor( const ::rtl::Reference< IEventProcessor >& _xProcessor )
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remove all events for this processor
m_xImpl->aEvents.erase(std::remove_if( m_xImpl->aEvents.begin(), m_xImpl->aEvents.end(), EqualProcessor( _xProcessor ) ), m_xImpl->aEvents.end());
@@ -97,7 +97,7 @@ namespace comphelper
void SAL_CALL AsyncEventNotifierBase::terminate()
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remember the termination request
m_xImpl->bTerminate = true;
@@ -109,7 +109,7 @@ namespace comphelper
void AsyncEventNotifierBase::addEvent( const AnyEventRef& _rEvent, const ::rtl::Reference< IEventProcessor >& _xProcessor )
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remember this event
m_xImpl->aEvents.emplace_back( ProcessableEvent {_rEvent, _xProcessor} );
diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx
index 472e085d642e..243634610c2b 100644
--- a/comphelper/source/streaming/oslfile2streamwrap.cxx
+++ b/comphelper/source/streaming/oslfile2streamwrap.cxx
@@ -53,7 +53,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8
aData.realloc(nBytesToRead);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_uInt64 nRead = 0;
FileBase::RC eError = m_pFile->read(static_cast<void*>(aData.getArray()), nBytesToRead, nRead);
@@ -80,7 +80,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readSomeBytes(css::uno::Sequence< sal_
void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_pFile)
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -97,7 +97,7 @@ void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OSLInputStreamWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_pFile)
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx
index e9291c6c9234..bd30aa354620 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -117,7 +117,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl()
sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -130,7 +130,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >&
sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -143,7 +143,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8
void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -156,7 +156,7 @@ void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip )
sal_Int32 SAL_CALL OSeekableInputWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -169,7 +169,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::available()
void SAL_CALL OSeekableInputWrapper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -191,7 +191,7 @@ void SAL_CALL OSeekableInputWrapper::closeInput()
void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -204,7 +204,7 @@ void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location )
sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -217,7 +217,7 @@ sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition()
sal_Int64 SAL_CALL OSeekableInputWrapper::getLength()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx
index d729fa7999c9..25596f17473c 100644
--- a/comphelper/source/streaming/seqinputstreamserv.cxx
+++ b/comphelper/source/streaming/seqinputstreamserv.cxx
@@ -103,7 +103,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
// css::io::XInputStream:
::sal_Int32 SAL_CALL SequenceInputStreamService::readBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -112,7 +112,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
::sal_Int32 SAL_CALL SequenceInputStreamService::readSomeBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -121,7 +121,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -130,7 +130,7 @@ void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
::sal_Int32 SAL_CALL SequenceInputStreamService::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -139,7 +139,7 @@ void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
void SAL_CALL SequenceInputStreamService::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -151,7 +151,7 @@ void SAL_CALL SequenceInputStreamService::closeInput()
// css::io::XSeekable:
void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -160,7 +160,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SequenceInputStreamService::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -169,7 +169,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SequenceInputStreamService::getLength()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -179,7 +179,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
// css::lang::XInitialization:
void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< css::uno::Any > & aArguments )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_bInitialized )
throw frame::DoubleInitializationException();
diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx
index e19ea1001ae8..d1ffc4df2d42 100644
--- a/comphelper/source/streaming/seqoutputstreamserv.cxx
+++ b/comphelper/source/streaming/seqoutputstreamserv.cxx
@@ -90,7 +90,7 @@ uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService::getSupportedServ
// css::io::XOutputStream:
void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sal_Int8 > & aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -99,7 +99,7 @@ void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sa
void SAL_CALL SequenceOutputStreamService::flush()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -108,7 +108,7 @@ void SAL_CALL SequenceOutputStreamService::flush()
void SAL_CALL SequenceOutputStreamService::closeOutput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -119,7 +119,7 @@ void SAL_CALL SequenceOutputStreamService::closeOutput()
// css::io::XSequenceOutputStream:
uno::Sequence< ::sal_Int8 > SAL_CALL SequenceOutputStreamService::getWrittenBytes()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx
index 9ad5db7254b8..db39a1dc30e8 100644
--- a/comphelper/source/streaming/seqstream.cxx
+++ b/comphelper/source/streaming/seqstream.cxx
@@ -60,7 +60,7 @@ sal_Int32 SAL_CALL SequenceInputStream::readBytes( Sequence<sal_Int8>& aData, sa
if (nBytesToRead < 0)
throw BufferSizeExceededException(OUString(),*this);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_Int32 nAvail = avail();
@@ -87,7 +87,7 @@ void SAL_CALL SequenceInputStream::skipBytes( sal_Int32 nBytesToSkip )
if (nBytesToSkip < 0)
throw BufferSizeExceededException(OUString(),*this);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_Int32 nAvail = avail();
@@ -100,7 +100,7 @@ void SAL_CALL SequenceInputStream::skipBytes( sal_Int32 nBytesToSkip )
sal_Int32 SAL_CALL SequenceInputStream::available( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return avail();
}
@@ -108,7 +108,7 @@ sal_Int32 SAL_CALL SequenceInputStream::available( )
void SAL_CALL SequenceInputStream::closeInput( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (m_nPos == -1)
throw NotConnectedException(OUString(), *this);
@@ -120,19 +120,19 @@ void SAL_CALL SequenceInputStream::seek( sal_Int64 location )
{
if ( location > m_aData.getLength() || location < 0 || location > SAL_MAX_INT32 )
throw IllegalArgumentException("bad location", static_cast<cppu::OWeakObject*>(this), 1);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_nPos = static_cast<sal_Int32>(location);
}
sal_Int64 SAL_CALL SequenceInputStream::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_nPos;
}
sal_Int64 SAL_CALL SequenceInputStream::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_aData.getLength();
}
@@ -153,7 +153,7 @@ OSequenceOutputStream::OSequenceOutputStream(Sequence< sal_Int8 >& _rSeq, double
void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rData )
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
@@ -193,7 +193,7 @@ void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rD
void SAL_CALL OSequenceOutputStream::flush( )
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
@@ -211,7 +211,7 @@ void OSequenceOutputStream::finalizeOutput()
void SAL_CALL OSequenceOutputStream::closeOutput()
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index 10354192d6f3..1e09645733e0 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -27,7 +27,7 @@ Check for unused classes where the compiler cannot decide (e.g. because of
non-trivial or extern ctors) if a variable is unused if only its ctor/dtor
are called and nothing else. For example std::vector is a class where
the ctor may call further functions, but an unused std::string variable
-does nothing. On the other hand, std::lock_guard instances are used
+does nothing. On the other hand, std::scoped_lock instances are used
for their dtors and so are not unused even if not otherwise accessed.
Classes which are safe to be warned about need to be marked using
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 033f9d94ce3f..2356948c51c5 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -76,7 +76,7 @@ static void s_setCurrent(uno_Environment * pEnv)
{
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
- std::lock_guard guard(s_threadMap_mutex);
+ std::scoped_lock guard(s_threadMap_mutex);
if (pEnv)
{
s_threadMap[threadId] = pEnv;
@@ -95,7 +95,7 @@ static uno_Environment * s_getCurrent()
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
- std::lock_guard guard(s_threadMap_mutex);
+ std::scoped_lock guard(s_threadMap_mutex);
ThreadMap::iterator iEnv = s_threadMap.find(threadId);
if(iEnv != s_threadMap.end())
pEnv = iEnv->second;
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index a39eb409a765..a88259627b2c 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -319,7 +319,7 @@ static OUString getBridgeName(
static void setNegativeBridge( const OUString & rBridgeName )
{
MappingsData & rData = getMappingsData();
- std::lock_guard aGuard( rData.aNegativeLibsMutex );
+ std::scoped_lock aGuard( rData.aNegativeLibsMutex );
rData.aNegativeLibs.insert( rBridgeName );
}
@@ -356,7 +356,7 @@ static bool loadModule(osl::Module & rModule, const OUString & rBridgeName)
bool bNeg;
{
MappingsData & rData = getMappingsData();
- std::lock_guard aGuard( rData.aNegativeLibsMutex );
+ std::scoped_lock aGuard( rData.aNegativeLibsMutex );
const auto iFind( rData.aNegativeLibs.find( rBridgeName ) );
bNeg = (iFind != rData.aNegativeLibs.end());
}
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
index 24b7a74582d7..4ced30adbe5c 100644
--- a/cppuhelper/source/implbase_ex.cxx
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -68,7 +68,7 @@ static type_entry * getTypeEntries( class_data * cd )
if (! cd->m_storedTypeRefs) // not inited?
{
static std::mutex aMutex;
- std::lock_guard guard( aMutex );
+ std::scoped_lock guard( aMutex );
if (! cd->m_storedTypeRefs) // not inited?
{
// get all types
diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx
index 0a270db6f17e..41f9442ff311 100644
--- a/cppuhelper/source/propertysetmixin.cxx
+++ b/cppuhelper/source/propertysetmixin.cxx
@@ -853,7 +853,7 @@ void PropertySetMixinImpl::prepareSet(
Impl::VetoListenerBag specificVeto;
Impl::VetoListenerBag unspecificVeto;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
if (m_impl->disposed) {
throw css::lang::DisposedException(
"disposed", static_cast< css::beans::XPropertySet * >(this));
@@ -922,7 +922,7 @@ void PropertySetMixinImpl::dispose() {
Impl::BoundListenerMap boundListeners;
Impl::VetoListenerMap vetoListeners;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
boundListeners.swap(m_impl->boundListeners);
vetoListeners.swap(m_impl->vetoListeners);
m_impl->disposed = true;
@@ -1001,7 +1001,7 @@ void PropertySetMixinImpl::addPropertyChangeListener(
checkUnknown(propertyName);
bool disposed;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
disposed = m_impl->disposed;
if (!disposed) {
m_impl->boundListeners[propertyName].insert(listener);
@@ -1020,7 +1020,7 @@ void PropertySetMixinImpl::removePropertyChangeListener(
{
assert(listener.is());
checkUnknown(propertyName);
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
Impl::BoundListenerMap::iterator i(
m_impl->boundListeners.find(propertyName));
if (i != m_impl->boundListeners.end()) {
@@ -1040,7 +1040,7 @@ void PropertySetMixinImpl::addVetoableChangeListener(
checkUnknown(propertyName);
bool disposed;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
disposed = m_impl->disposed;
if (!disposed) {
m_impl->vetoListeners[propertyName].insert(listener);
@@ -1059,7 +1059,7 @@ void PropertySetMixinImpl::removeVetoableChangeListener(
{
assert(listener.is());
checkUnknown(propertyName);
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
Impl::VetoListenerMap::iterator i(m_impl->vetoListeners.find(propertyName));
if (i != m_impl->vetoListeners.end()) {
Impl::VetoListenerBag::iterator j(i->second.find(listener));
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index bf8e13fcc53e..6cabae88f0dc 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -470,13 +470,13 @@ private:
sal_Bool ContentEnumeration::hasMoreElements()
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
return iterator_ != factories_.end();
}
css::uno::Any ContentEnumeration::nextElement()
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (iterator_ == factories_.end()) {
throw css::container::NoSuchElementException(
"Bootstrap service manager service enumerator has no more elements",
diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx
index b97d36d16aed..12c25ddc92bc 100644
--- a/cppuhelper/source/typemanager.cxx
+++ b/cppuhelper/source/typemanager.cxx
@@ -1679,7 +1679,7 @@ Enumeration::nextTypeDescription()
{
OUString name;
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (positions_.empty()) {
throw css::container::NoSuchElementException(
"exhausted XTypeDescriptionEnumeration",
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index b7988dbeff7b..348e8d54f791 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -305,7 +305,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xALAS;
if( xALAS.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xInvocationAdapterFactory = xALAS;
}
// Introspection service ?
@@ -313,7 +313,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xI;
if( xI.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xIntrospection = xI;
}
// Reflection service ?
@@ -321,7 +321,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xIdlR;
if( xIdlR.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xReflection = xIdlR;
}
// Converter Service ?
@@ -329,7 +329,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xC;
if( xC.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xConverter = xC;
}
@@ -343,7 +343,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
//*** Private helper methods ***
Reference< XIntrospection > EventAttacherImpl::getIntrospection()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xIntrospection.is() )
{
m_xIntrospection = theIntrospection::get( m_xContext );
@@ -355,7 +355,7 @@ Reference< XIntrospection > EventAttacherImpl::getIntrospection()
//*** Private helper methods ***
Reference< XIdlReflection > EventAttacherImpl::getReflection()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xReflection.is() )
{
m_xReflection = theCoreReflection::get(m_xContext);
@@ -367,7 +367,7 @@ Reference< XIdlReflection > EventAttacherImpl::getReflection()
//*** Private helper methods ***
Reference< XInvocationAdapterFactory2 > EventAttacherImpl::getInvocationAdapterService()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xInvocationAdapterFactory.is() )
{
m_xInvocationAdapterFactory = InvocationAdapterFactory::create(m_xContext);
@@ -379,7 +379,7 @@ Reference< XInvocationAdapterFactory2 > EventAttacherImpl::getInvocationAdapterS
//*** Private helper methods ***
Reference< XTypeConverter > EventAttacherImpl::getConverter()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xConverter.is() )
{
m_xConverter = Converter::create(m_xContext);
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 702436b1dc61..45c96b373f1a 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -66,7 +66,7 @@ StatusIndicatorFactory::~StatusIndicatorFactory()
void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
{
if (lArguments.hasElements()) {
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
css::uno::Reference< css::frame::XFrame > xTmpFrame;
css::uno::Reference< css::awt::XWindow > xTmpWindow;
@@ -103,7 +103,7 @@ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL StatusIndicatorFacto
void SAL_CALL StatusIndicatorFactory::update()
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_bAllowReschedule = true;
}
@@ -114,7 +114,7 @@ void StatusIndicatorFactory::start(const css::uno::Reference< css::task::XStatus
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
// create new info structure for this child or move it to the front of our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -143,7 +143,7 @@ void StatusIndicatorFactory::reset(const css::uno::Reference< css::task::XStatus
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
// reset the internal info structure related to this child
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -177,7 +177,7 @@ void StatusIndicatorFactory::end(const css::uno::Reference< css::task::XStatusIn
sal_Int32 nValue = 0;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
// remove this child from our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -231,7 +231,7 @@ void StatusIndicatorFactory::setText(const css::uno::Reference< css::task::XStat
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
@@ -263,7 +263,7 @@ void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XSt
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
@@ -296,7 +296,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
css::uno::Reference< css::uno::XComponentContext > xContext;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
if (!m_bAllowParentShow)
return;
@@ -390,7 +390,7 @@ void StatusIndicatorFactory::impl_createProgress()
css::uno::Reference< css::awt::XWindow > xWindow;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
xWindow = m_xPluggWindow;
@@ -427,7 +427,7 @@ void StatusIndicatorFactory::impl_createProgress()
}
}
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_xProgress = xProgress;
}
@@ -436,7 +436,7 @@ void StatusIndicatorFactory::impl_showProgress()
css::uno::Reference< css::frame::XFrame > xFrame;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
}
@@ -468,7 +468,7 @@ void StatusIndicatorFactory::impl_showProgress()
}
}
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_xProgress = xProgress;
}
@@ -477,7 +477,7 @@ void StatusIndicatorFactory::impl_hideProgress()
css::uno::Reference< css::frame::XFrame > xFrame;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
}
@@ -501,7 +501,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
{
// SAFE ->
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
if (m_bDisableReschedule)
return;
}
@@ -510,7 +510,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
bool bReschedule = bForce;
if (!bReschedule)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
bReschedule = m_bAllowReschedule;
m_bAllowReschedule = false;
}
@@ -540,7 +540,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
void StatusIndicatorFactory::impl_startWakeUpThread()
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
if (m_bDisableReschedule)
return;
@@ -556,7 +556,7 @@ void StatusIndicatorFactory::impl_stopWakeUpThread()
{
rtl::Reference<WakeUpThread> wakeUp;
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
std::swap(wakeUp, m_pWakeUp);
}
if (wakeUp.is())
diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx
index cfa4a8a2bbe1..30e424df94ff 100644
--- a/framework/source/services/dispatchhelper.cxx
+++ b/framework/source/services/dispatchhelper.cxx
@@ -95,7 +95,7 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
css::uno::Reference<css::util::XURLTransformer> xParser;
/* SAFE { */
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xParser = css::util::URLTransformer::create(m_xContext);
}
/* } SAFE */
@@ -150,7 +150,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>
css::uno::UNO_QUERY);
/* SAFE { */
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
m_xBroadcaster = xNotifyDispatch;
m_aBlockFlag = false;
}
@@ -184,7 +184,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>
*/
void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultEvent& aResult)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_aResult <<= aResult;
m_aBlockFlag = true;
m_aBlock.notify_one();
@@ -198,7 +198,7 @@ void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultE
*/
void SAL_CALL DispatchHelper::disposing(const css::lang::EventObject&)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_aResult.clear();
m_aBlockFlag = true;
m_aBlock.notify_one();
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index b337fc50f2c6..8e2f9128a685 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -554,7 +554,7 @@ struct Separators
Separators getLocaleSeparators(const Locale& rLocale, const OUString& rLocStr)
{
// Guard the static variable below.
- std::lock_guard aGuard(theNatNumMutex);
+ std::scoped_lock aGuard(theNatNumMutex);
// Maximum a couple hundred of pairs with 4-byte structs - so no need for smart managing
static std::unordered_map<OUString, Separators> aLocaleSeparatorsBuf;
auto it = aLocaleSeparatorsBuf.find(rLocStr);
@@ -603,7 +603,7 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
= css::linguistic2::NumberText::create(comphelper::getProcessComponentContext());
// Guard the static variables below.
- std::lock_guard aGuard( theNatNumMutex );
+ std::scoped_lock aGuard( theNatNumMutex );
OUString numbertext_prefix;
// default "cardinal" gets empty prefix
diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx
index 0e76f087b02f..c20ed5b20edc 100644
--- a/i18npool/source/numberformatcode/numberformatcode.cxx
+++ b/i18npool/source/numberformatcode/numberformatcode.cxx
@@ -43,7 +43,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage,
OUString elementType = mapElementTypeShortToString(formatType);
OUString elementUsage = mapElementUsageShortToString(formatUsage);
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(),
@@ -67,7 +67,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage,
css::i18n::NumberFormatCode SAL_CALL
NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(),
@@ -88,7 +88,7 @@ NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::L
css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL
NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
std::vector<css::i18n::NumberFormatCode> aVec;
@@ -113,7 +113,7 @@ NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang
css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL
NumberFormatCodeMapper::getAllFormatCodes( const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
std::vector<css::i18n::NumberFormatCode> aVec;
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx
index 98274af16d46..987642538f0e 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -161,7 +161,7 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage(
::sal_Int32 nStartPos,
::sal_Int32 nLen )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -190,7 +190,7 @@ void LangGuess_Impl::SetFingerPrintsDB(
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -212,7 +212,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages( )
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -234,7 +234,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages( )
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -257,7 +257,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages( )
void SAL_CALL LangGuess_Impl::disableLanguages(
const uno::Sequence< Locale >& rLanguages )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -278,7 +278,7 @@ void SAL_CALL LangGuess_Impl::disableLanguages(
void SAL_CALL LangGuess_Impl::enableLanguages(
const uno::Sequence< Locale >& rLanguages )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
diff --git a/lingucomponent/source/numbertext/numbertext.cxx b/lingucomponent/source/numbertext/numbertext.cxx
index 5b9a32a65196..f878a55f591c 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -112,7 +112,7 @@ void NumberText_Impl::EnsureInitialized()
OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& rLocale)
{
- std::lock_guard aGuard(GetNumberTextMutex());
+ std::scoped_lock aGuard(GetNumberTextMutex());
EnsureInitialized();
// libnumbertext supports Language + Country tags (separated by "_" or "-")
LanguageTag aLanguageTag(rLocale);
@@ -142,7 +142,7 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Lo
uno::Sequence<Locale> SAL_CALL NumberText_Impl::getAvailableLanguages()
{
- std::lock_guard aGuard(GetNumberTextMutex());
+ std::scoped_lock aGuard(GetNumberTextMutex());
// TODO
Sequence<css::lang::Locale> aRes;
return aRes;
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index ac9ad9de37e9..363b5f445a47 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -576,7 +576,7 @@ static std::mutex s_GetCharClassMutex;
bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage )
{
- std::lock_guard aGuard( s_GetCharClassMutex );
+ std::scoped_lock aGuard( s_GetCharClassMutex );
CharClass &rCC = lcl_GetCharClass();
rCC.setLanguageTag( LanguageTag( nLanguage ));
@@ -612,7 +612,7 @@ CapType capitalType(const OUString& aTerm, CharClass const * pCC)
OUString ToLower( const OUString &rText, LanguageType nLanguage )
{
- std::lock_guard aGuard( s_GetCharClassMutex );
+ std::scoped_lock aGuard( s_GetCharClassMutex );
CharClass &rCC = lcl_GetCharClass();
rCC.setLanguageTag( LanguageTag( nLanguage ));
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 7dd362a32954..ea22d1fbb8bc 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -93,7 +93,7 @@ private:
DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
{
UrlPool& rUrlPool = StaticUrlPool::get();
- std::lock_guard aGuard( rUrlPool.maMutex );
+ std::scoped_lock aGuard( rUrlPool.maMutex );
mbValid = rUrl.isEmpty() || (rUrlPool.maUrls.count( rUrl ) == 0);
if( mbValid && !rUrl.isEmpty() )
{
@@ -105,7 +105,7 @@ DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
DocumentOpenedGuard::~DocumentOpenedGuard()
{
UrlPool& rUrlPool = StaticUrlPool::get();
- std::lock_guard aGuard( rUrlPool.maMutex );
+ std::scoped_lock aGuard( rUrlPool.maMutex );
if( !maUrl.isEmpty() )
rUrlPool.maUrls.erase( maUrl );
}
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index e069efe3c537..afb6ef6ff6f6 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -125,7 +125,7 @@ Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo()
void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
{
- std::lock_guard aGuard( mMutex );
+ std::scoped_lock aGuard( mMutex );
maPropMap[ rPropertyName ] = rValue;
}
diff --git a/package/source/xstor/disposelistener.cxx b/package/source/xstor/disposelistener.cxx
index ab30f99ca129..b7ee40957465 100644
--- a/package/source/xstor/disposelistener.cxx
+++ b/package/source/xstor/disposelistener.cxx
@@ -31,13 +31,13 @@ OChildDispListener_Impl::~OChildDispListener_Impl()
void OChildDispListener_Impl::OwnerIsDisposed()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_pStorage = nullptr;
}
void SAL_CALL OChildDispListener_Impl::disposing( const lang::EventObject& Source )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
// ObjectIsDisposed must not contain any locking!
if ( m_pStorage && Source.Source.is() )
m_pStorage->ChildIsDisposed( Source.Source );
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx
index e646a3f06245..ff9828a72b91 100644
--- a/package/source/xstor/switchpersistencestream.cxx
+++ b/package/source/xstor/switchpersistencestream.cxx
@@ -200,7 +200,7 @@ void SwitchablePersistenceStream::CloseAll_Impl()
// css::io::XStream
uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInputStream( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_pStreamData )
m_pStreamData->m_bInOpen = true;
@@ -209,7 +209,7 @@ uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInpu
uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOutputStream( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_pStreamData )
m_pStreamData->m_bOutOpen = true;
@@ -219,7 +219,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
// css::io::XInputStream
::sal_Int32 SAL_CALL SwitchablePersistenceStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -233,7 +233,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
::sal_Int32 SAL_CALL SwitchablePersistenceStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -247,7 +247,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -261,7 +261,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
::sal_Int32 SAL_CALL SwitchablePersistenceStream::available( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -275,7 +275,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
void SAL_CALL SwitchablePersistenceStream::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -288,7 +288,7 @@ void SAL_CALL SwitchablePersistenceStream::closeInput()
// css::io::XOutputStream
void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -305,7 +305,7 @@ void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sa
void SAL_CALL SwitchablePersistenceStream::flush( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData || m_pStreamData->m_bInStreamBased )
{
@@ -325,7 +325,7 @@ void SAL_CALL SwitchablePersistenceStream::flush( )
void SAL_CALL SwitchablePersistenceStream::closeOutput( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -338,7 +338,7 @@ void SAL_CALL SwitchablePersistenceStream::closeOutput( )
// css::io::XTruncate
void SAL_CALL SwitchablePersistenceStream::truncate( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -356,7 +356,7 @@ void SAL_CALL SwitchablePersistenceStream::truncate( )
// css::io::XSeekable
void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -370,7 +370,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SwitchablePersistenceStream::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -384,7 +384,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SwitchablePersistenceStream::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx
index 3b039e5000b1..89ce1af5634b 100644
--- a/package/source/zipapi/ByteGrabber.cxx
+++ b/package/source/zipapi/ByteGrabber.cxx
@@ -48,7 +48,7 @@ ByteGrabber::~ByteGrabber()
void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNewStream)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
xStream = xNewStream;
xSeek.set(xNewStream, uno::UNO_QUERY);
}
@@ -57,14 +57,14 @@ void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNe
sal_Int32 ByteGrabber::readBytes( uno::Sequence< sal_Int8 >& aData,
sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return xStream->readBytes(aData, nBytesToRead );
}
// XSeekable chained...
void ByteGrabber::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -76,7 +76,7 @@ void ByteGrabber::seek( sal_Int64 location )
sal_Int64 ByteGrabber::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -85,7 +85,7 @@ sal_Int64 ByteGrabber::getPosition( )
sal_Int64 ByteGrabber::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -94,7 +94,7 @@ sal_Int64 ByteGrabber::getLength( )
sal_uInt16 ByteGrabber::ReadUInt16()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (xStream->readBytes(aSequence, 2) != 2)
return 0;
@@ -107,7 +107,7 @@ sal_uInt16 ByteGrabber::ReadUInt16()
sal_uInt32 ByteGrabber::ReadUInt32()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (xStream->readBytes(aSequence, 4) != 4)
return 0;
diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx
index d11a9f0d3c01..1b5ed4a14893 100644
--- a/package/source/zipapi/blowfishcontext.cxx
+++ b/package/source/zipapi/blowfishcontext.cxx
@@ -62,7 +62,7 @@ BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext()
uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pCipher )
throw lang::DisposedException();
@@ -96,7 +96,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC
uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pCipher )
throw lang::DisposedException();
diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx
index 0da0648ea206..4b6cbd2d339d 100644
--- a/package/source/zipapi/sha1context.cxx
+++ b/package/source/zipapi/sha1context.cxx
@@ -49,7 +49,7 @@ StarOfficeSHA1DigestContext::~StarOfficeSHA1DigestContext()
void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& aData)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pDigest )
throw lang::DisposedException();
@@ -64,7 +64,7 @@ void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sa
uno::Sequence<::sal_Int8> SAL_CALL StarOfficeSHA1DigestContext::finalizeDigestAndDispose()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pDigest )
throw lang::DisposedException();
@@ -98,7 +98,7 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext()
void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData)
{
- std::lock_guard aGuard(m_Mutex);
+ std::scoped_lock aGuard(m_Mutex);
if (m_bDisposed)
throw lang::DisposedException();
@@ -107,7 +107,7 @@ void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_I
uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose()
{
- std::lock_guard aGuard(m_Mutex);
+ std::scoped_lock aGuard(m_Mutex);
if (m_bDisposed)
throw lang::DisposedException();
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 980c092c796e..05a874cb3c33 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -601,7 +601,7 @@ void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumen
// Error during parsing !
Any savedException;
{
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
if (maSavedException.hasValue())
{
savedException.setValue(&maSavedException, cppu::UnoType<decltype(maSavedException)>::get());
@@ -643,7 +643,7 @@ void Entity::saveException( const Any & e )
// unexpectedly some 'startElements' produce a UNO_QUERY_THROW
// for XComponent; and yet expect to continue parsing.
SAL_WARN("sax", "Unexpected exception from XML parser " << exceptionToString(e));
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
if (maSavedException.hasValue())
{
SAL_INFO("sax.fastparser", "discarding exception, already have one");
@@ -656,7 +656,7 @@ void Entity::saveException( const Any & e )
bool Entity::hasException()
{
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
return maSavedException.hasValue();
}
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index 865d37bf2933..c7d7e52bfccf 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -55,7 +55,7 @@ ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {
ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)
{
- std::lock_guard aGuard(maMtxTables);
+ std::scoped_lock aGuard(maMtxTables);
TablesType::iterator itTab = maTables.find(nTab);
if (itTab == maTables.end())
@@ -93,7 +93,7 @@ ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL
void ColumnBlockPositionSet::clear()
{
- std::lock_guard aGuard(maMtxTables);
+ std::scoped_lock aGuard(maMtxTables);
maTables.clear();
}
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 71cfa4eaf4ff..bf495c06c337 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -91,7 +91,7 @@ std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const
{
std::unique_ptr<SvNumberFormatter> p;
{
- std::lock_guard aGuard(maMtxCreateNumFormatter);
+ std::scoped_lock aGuard(maMtxCreateNumFormatter);
p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM));
}
p->SetColorLink( LINK(&m_rSourceDoc, ScDocument, GetUserDefinedColor) );
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 63cbfe5736f0..3dd1b70e20f8 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -115,7 +115,7 @@ OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocumen
return GetMultilineString( rEditText );
static std::mutex aMutex;
- std::lock_guard aGuard( aMutex);
+ std::scoped_lock aGuard( aMutex);
// ScFieldEditEngine is needed to resolve field contents.
if (pDoc)
{
diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx
index 35c8eace9b40..bd1e0447d7a6 100644
--- a/sc/source/core/tool/refreshtimer.cxx
+++ b/sc/source/core/tool/refreshtimer.cxx
@@ -36,7 +36,7 @@ ScRefreshTimerProtector::ScRefreshTimerProtector( std::unique_ptr<ScRefreshTimer
{
m_rpControl->SetAllowRefresh( false );
// wait for any running refresh in another thread to finish
- std::lock_guard aGuard( m_rpControl->GetMutex() );
+ std::scoped_lock aGuard( m_rpControl->GetMutex() );
}
}
@@ -122,7 +122,7 @@ void ScRefreshTimer::Invoke()
if ( ppControl && *ppControl && (*ppControl)->IsRefreshAllowed() )
{
// now we COULD make the call in another thread ...
- std::lock_guard aGuard( (*ppControl)->GetMutex() );
+ std::scoped_lock aGuard( (*ppControl)->GetMutex() );
Timer::Invoke();
// restart from now on, don't execute immediately again if timed out
// a second time during refresh
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 40470d0bc966..a93043830892 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -398,7 +398,7 @@ void FormulaBuffer::finalizeImport()
FormulaBuffer::SheetItem FormulaBuffer::getSheetItem( SCTAB nTab )
{
- std::lock_guard aGuard(maMtxData);
+ std::scoped_lock aGuard(maMtxData);
SheetItem aItem;
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index e8719c8cb4aa..57cc596a7878 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -335,7 +335,7 @@ MasterScriptProvider::providerCache()
{
if ( !m_pPCache )
{
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
if ( !m_pPCache )
{
Sequence<OUString> denylist { "com.sun.star.script.provider.ScriptProviderForBasic" };
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 765de8c155d0..4fb6c0ba230c 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -62,7 +62,7 @@ ProviderCache::~ProviderCache()
Reference< provider::XScriptProvider >
ProviderCache::getProvider( const OUString& providerName )
{
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
Reference< provider::XScriptProvider > provider;
ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.find( providerName );
if ( h_it != m_hProviderDetailsCache.end() )
@@ -86,7 +86,7 @@ ProviderCache::getAllProviders()
// need to create providers that haven't been created already
// so check what providers exist and what ones don't
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
// should assert if size !> 0
if ( !m_hProviderDetailsCache.empty() )
@@ -132,7 +132,7 @@ ProviderCache::populateCache()
{
// wrong name in services.rdb
OUString serviceName;
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
try
{
Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, UNO_QUERY_THROW );
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
index 6e082d9019fa..c3fc1b207ece 100644
--- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -73,7 +73,7 @@ void ResourceFactoryManager::AddFactory (
if (rsURL.isEmpty())
throw lang::IllegalArgumentException();
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
if (rsURL.indexOf('*') >= 0 || rsURL.indexOf('?') >= 0)
{
@@ -100,7 +100,7 @@ void ResourceFactoryManager::RemoveFactoryForURL (
if (rsURL.isEmpty())
throw lang::IllegalArgumentException();
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
FactoryMap::iterator iFactory (maFactoryMap.find(rsURL));
if (iFactory != maFactoryMap.end())
@@ -123,7 +123,7 @@ void ResourceFactoryManager::RemoveFactoryForURL (
void ResourceFactoryManager::RemoveFactoryForReference(
const Reference<XResourceFactory>& rxFactory)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
// Collect a list with all keys that map to the given factory.
::std::vector<OUString> aKeys;
@@ -178,7 +178,7 @@ Reference<XResourceFactory> ResourceFactoryManager::GetFactory (
Reference<XResourceFactory> ResourceFactoryManager::FindFactory (const OUString& rsURLBase)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
FactoryMap::const_iterator iFactory (maFactoryMap.find(rsURLBase));
if (iFactory != maFactoryMap.end())
return iFactory->second;
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
index d515d21cf580..4b060879ae24 100644
--- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
@@ -145,7 +145,7 @@ void QueueProcessor::ProcessOneRequest (
{
try
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
// Create a new preview bitmap and store it in the cache.
if (mpCache != nullptr && mpCacheContext)
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index 9130621ff762..1e020bc027a2 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -167,7 +167,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken )
{
if ( !pHashMap )
{ // init hash map
- std::lock_guard aGuard( getHashMapMutex() );
+ std::scoped_lock aGuard( getHashMapMutex() );
if ( !pHashMap )
{
TypeNameHashMap* pH = new TypeNameHashMap;
diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx
index f46fcd288ee0..67281e368b18 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -184,7 +184,7 @@ sal_Int32 TimerScheduler::mnTaskId = PresenterTimer::NotAValidTaskId;
std::shared_ptr<TimerScheduler> TimerScheduler::Instance(
uno::Reference<uno::XComponentContext> const& xContext)
{
- std::lock_guard aGuard (maInstanceMutex);
+ std::scoped_lock aGuard (maInstanceMutex);
if (mpInstance == nullptr)
{
if (!xContext.is())
@@ -226,7 +226,7 @@ void TimerScheduler::ScheduleTask (const SharedTimerTask& rpTask)
return;
{
- std::lock_guard aTaskGuard (maTaskContainerMutex);
+ std::scoped_lock aTaskGuard (maTaskContainerMutex);
maScheduledTasks.insert(rpTask);
}
}
@@ -237,7 +237,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
// task ids. Therefore we have to do a linear search for the task to
// cancel.
{
- std::lock_guard aGuard (maTaskContainerMutex);
+ std::scoped_lock aGuard (maTaskContainerMutex);
auto iTask = std::find_if(maScheduledTasks.begin(), maScheduledTasks.end(),
[nTaskId](const SharedTimerTask& rxTask) { return rxTask->mnTaskId == nTaskId; });
if (iTask != maScheduledTasks.end())
@@ -248,7 +248,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
// processed. Mark it with a flag that a) prevents a repeating task
// from being scheduled again and b) tries to prevent its execution.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
if (mpCurrentTask
&& mpCurrentTask->mnTaskId == nTaskId)
mpCurrentTask->mbIsCanceled = true;
@@ -266,12 +266,12 @@ void TimerScheduler::NotifyTermination()
}
{
- std::lock_guard aGuard(pInstance->maTaskContainerMutex);
+ std::scoped_lock aGuard(pInstance->maTaskContainerMutex);
pInstance->maScheduledTasks.clear();
}
{
- std::lock_guard aGuard(pInstance->maCurrentTaskMutex);
+ std::scoped_lock aGuard(pInstance->maCurrentTaskMutex);
if (pInstance->mpCurrentTask)
{
pInstance->mpCurrentTask->mbIsCanceled = true;
@@ -303,7 +303,7 @@ void SAL_CALL TimerScheduler::run()
SharedTimerTask pTask;
sal_Int64 nDifference = 0;
{
- std::lock_guard aGuard (maTaskContainerMutex);
+ std::scoped_lock aGuard (maTaskContainerMutex);
// There are no more scheduled task. Leave this loop, function and
// live of the TimerScheduler.
@@ -322,7 +322,7 @@ void SAL_CALL TimerScheduler::run()
// Acquire a reference to the current task.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
mpCurrentTask = pTask;
}
@@ -356,13 +356,13 @@ void SAL_CALL TimerScheduler::run()
// Release reference to the current task.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
mpCurrentTask.reset();
}
}
// While holding maInstanceMutex
- std::lock_guard aInstance( maInstanceMutex );
+ std::scoped_lock aInstance( maInstanceMutex );
mpLateDestroy = mpInstance;
mpInstance.reset();
}
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index 36c321bf3b24..453f67a8d5b4 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -517,7 +517,7 @@ ThumbnailViewItemAcc::~ThumbnailViewItemAcc()
void ThumbnailViewItemAcc::ParentDestroyed()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
mpParent = nullptr;
}
@@ -731,7 +731,7 @@ lang::Locale SAL_CALL ThumbnailViewItemAcc::getLocale()
void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( !rxListener.is() )
return;
@@ -753,7 +753,7 @@ void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Refer
void SAL_CALL ThumbnailViewItemAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( rxListener.is() )
{
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index f4fdb55037db..a35ce5269782 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -2670,7 +2670,7 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
{
if ( !mxOfficeInstDirs.is() )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if ( !mxOfficeInstDirs.is() )
{
OSL_ENSURE( mxContext.is(), "No service manager!" );
diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx
index 0e888db85567..73bf2a398e73 100644
--- a/slideshow/source/engine/eventqueue.cxx
+++ b/slideshow/source/engine/eventqueue.cxx
@@ -77,7 +77,7 @@ namespace slideshow::internal
bool EventQueue::addEvent( const EventSharedPtr& rEvent )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get()
@@ -103,7 +103,7 @@ namespace slideshow::internal
bool EventQueue::addEventForNextRound( EventSharedPtr const& rEvent )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get()
@@ -120,7 +120,7 @@ namespace slideshow::internal
bool EventQueue::addEventWhenQueueIsEmpty (const EventSharedPtr& rpEvent)
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription()
<< "\" [" << rpEvent.get()
@@ -140,14 +140,14 @@ namespace slideshow::internal
void EventQueue::forceEmpty()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
process_(true);
}
void EventQueue::process()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
process_(false);
}
@@ -257,14 +257,14 @@ namespace slideshow::internal
bool EventQueue::isEmpty() const
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return maEvents.empty() && maNextEvents.empty() && maNextNextEvents.empty();
}
double EventQueue::nextTimeout() const
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
// return time for next entry (if any)
double nTimeout (::std::numeric_limits<double>::max());
@@ -281,7 +281,7 @@ namespace slideshow::internal
void EventQueue::clear()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
// TODO(P1): Maybe a plain vector and vector.swap will
// be faster here. Profile.
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index cf75b1cf63cf..09b435550feb 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -146,7 +146,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
if (nBytesToRead < 0)
throw BufferSizeExceededException(OUString(),static_cast<XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -190,7 +190,7 @@ void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip)
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkError();
m_pSvStream->SeekRel(nBytesToSkip);
@@ -203,7 +203,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available()
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_Int64 nAvailable = m_pSvStream->remainingSize();
@@ -218,7 +218,7 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput()
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream.reset();
#if OSL_DEBUG_LEVEL > 0
@@ -234,7 +234,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation )
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
@@ -247,7 +247,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( )
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_uInt32 nPos = m_pSvStream->Tell();
@@ -261,7 +261,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
checkError();
diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx
index c004d605485a..d5eebe804f46 100644
--- a/stoc/source/corereflection/lrucache.hxx
+++ b/stoc/source/corereflection/lrucache.hxx
@@ -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
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock 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 )
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock 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()
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock aGuard( _aCacheMutex );
_aKey2Element.clear();
for ( sal_Int32 nPos = _nCachedElements; nPos--; )
{
diff --git a/stoc/source/javavm/interact.cxx b/stoc/source/javavm/interact.cxx
index 45fba8aab597..4836a0710c2d 100644
--- a/stoc/source/javavm/interact.cxx
+++ b/stoc/source/javavm/interact.cxx
@@ -68,13 +68,13 @@ private:
void SAL_CALL InteractionRequest::RetryContinuation::select()
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_bSelected = true;
}
bool InteractionRequest::RetryContinuation::isSelected() const
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_bSelected;
}
diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx
index efc33e5adf77..b600ab9c6794 100644
--- a/stoc/source/namingservice/namingservice.cxx
+++ b/stoc/source/namingservice/namingservice.cxx
@@ -89,7 +89,7 @@ Sequence< OUString > NamingService_Impl::getSupportedServiceNames()
// XServiceInfo
Reference< XInterface > NamingService_Impl::getRegisteredObject( const OUString& Name )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
Reference< XInterface > xRet;
HashMap_OWString_Interface::iterator aIt = aMap.find( Name );
if( aIt != aMap.end() )
@@ -100,14 +100,14 @@ Reference< XInterface > NamingService_Impl::getRegisteredObject( const OUString&
// XServiceInfo
void NamingService_Impl::registerObject( const OUString& Name, const Reference< XInterface >& Object )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
aMap[ Name ] = Object;
}
// XServiceInfo
void NamingService_Impl::revokeObject( const OUString& Name )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
aMap.erase( Name );
}
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index ad7cef754c60..d63a45abbfee 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -146,14 +146,14 @@ private:
// XEnumeration
sal_Bool ServiceEnumeration_Impl::hasMoreElements()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return nIt != aFactories.getLength();
}
// XEnumeration
Any ServiceEnumeration_Impl::nextElement()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
if( nIt == aFactories.getLength() )
throw NoSuchElementException("no more elements");
@@ -224,14 +224,14 @@ private:
// XEnumeration
sal_Bool ImplementationEnumeration_Impl::hasMoreElements()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return aIt != aImplementationMap.end();
}
// XEnumeration
Any ImplementationEnumeration_Impl::nextElement()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
if( aIt == aImplementationMap.end() )
throw NoSuchElementException("no more elements");
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 7b7b9d8d132d..6175de241400 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -179,18 +179,18 @@ private:
};
OUString Key::getKeyName() {
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.getName();
}
sal_Bool Key::isReadOnly()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.isReadOnly();
}
sal_Bool Key::isValid() {
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.isValid();
}
@@ -201,7 +201,7 @@ css::registry::RegistryKeyType Key::getKeyType(OUString const & )
css::registry::RegistryValueType Key::getValueType()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -242,7 +242,7 @@ css::registry::RegistryValueType Key::getValueType()
sal_Int32 Key::getLongValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
sal_Int32 value;
RegError err = key_.getValue(OUString(), &value);
switch (err) {
@@ -264,7 +264,7 @@ sal_Int32 Key::getLongValue()
void Key::setLongValue(sal_Int32 value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::LONG, &value, sizeof (sal_Int32));
if (err != RegError::NO_ERROR) {
@@ -277,7 +277,7 @@ void Key::setLongValue(sal_Int32 value)
css::uno::Sequence< sal_Int32 > Key::getLongListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Int32 > list;
RegError err = key_.getLongListValue(OUString(), list);
switch (err) {
@@ -313,7 +313,7 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
auto list = comphelper::sequenceToContainer<std::vector<sal_Int32>>(seqValue);
RegError err = key_.setLongListValue(
OUString(), list.data(), static_cast< sal_uInt32 >(list.size()));
@@ -327,7 +327,7 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
OUString Key::getAsciiValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -390,7 +390,7 @@ OUString Key::getAsciiValue()
void Key::setAsciiValue(OUString const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
OString utf8;
if (!value.convertToString(
&utf8, RTL_TEXTENCODING_UTF8,
@@ -416,7 +416,7 @@ void Key::setAsciiValue(OUString const & value)
css::uno::Sequence< OUString > Key::getAsciiListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< char * > list;
RegError err = key_.getStringListValue(OUString(), list);
switch (err) {
@@ -469,7 +469,7 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
void Key::setAsciiListValue(
css::uno::Sequence< OUString > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
std::vector< OString > list;
for (const auto& rValue : seqValue) {
OString utf8;
@@ -503,7 +503,7 @@ void Key::setAsciiListValue(
OUString Key::getStringValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -554,7 +554,7 @@ OUString Key::getStringValue()
void Key::setStringValue(OUString const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::UNICODE,
const_cast< sal_Unicode * >(value.getStr()),
@@ -570,7 +570,7 @@ void Key::setStringValue(OUString const & value)
css::uno::Sequence< OUString > Key::getStringListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Unicode * > list;
RegError err = key_.getUnicodeListValue(OUString(), list);
switch (err) {
@@ -609,7 +609,7 @@ css::uno::Sequence< OUString > Key::getStringListValue()
void Key::setStringListValue(
css::uno::Sequence< OUString > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
std::vector< sal_Unicode * > list;
list.reserve(seqValue.getLength());
std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(list),
@@ -627,7 +627,7 @@ void Key::setStringListValue(
css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -662,7 +662,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::BINARY,
const_cast< sal_Int8 * >(value.getConstArray()),
@@ -678,7 +678,7 @@ void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
RegError err = key_.openKey(aKeyName, key);
switch (err) {
@@ -697,7 +697,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
RegError err = key_.createKey(aKeyName, key);
switch (err) {
@@ -715,7 +715,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
void Key::closeKey()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.closeKey();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -727,7 +727,7 @@ void Key::closeKey()
void Key::deleteKey(OUString const & rKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.deleteKey(rKeyName);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -740,7 +740,7 @@ void Key::deleteKey(OUString const & rKeyName)
css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
Key::openKeys()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKeyArray list;
RegError err = key_.openSubKeys(OUString(), list);
if (err != RegError::NO_ERROR) {
@@ -767,7 +767,7 @@ Key::openKeys()
css::uno::Sequence< OUString > Key::getKeyNames()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKeyNames list;
RegError err = key_.getKeyNames(OUString(), list);
if (err != RegError::NO_ERROR) {
@@ -814,7 +814,7 @@ OUString Key::getLinkTarget(OUString const & /*rLinkName*/)
OUString Key::getResolvedName(OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
OUString resolved;
RegError err = key_.getResolvedKeyName(aKeyName, resolved);
if (err != RegError::NO_ERROR) {
@@ -827,14 +827,14 @@ OUString Key::getResolvedName(OUString const & aKeyName)
}
OUString SimpleRegistry::getURL() {
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.getName();
}
void SimpleRegistry::open(
OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = (rURL.isEmpty() && bCreate)
? RegError::REGISTRY_NOT_EXISTS
: registry_.open(rURL, bReadOnly ? RegAccessMode::READONLY : RegAccessMode::READWRITE);
@@ -850,13 +850,13 @@ void SimpleRegistry::open(
}
sal_Bool SimpleRegistry::isValid() {
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.isValid();
}
void SimpleRegistry::close()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = registry_.close();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -868,7 +868,7 @@ void SimpleRegistry::close()
void SimpleRegistry::destroy()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = registry_.destroy(OUString());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -880,7 +880,7 @@ void SimpleRegistry::destroy()
css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegistryKey root;
RegError err = registry_.openRootKey(root);
if (err != RegError::NO_ERROR) {
@@ -894,14 +894,14 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
sal_Bool SimpleRegistry::isReadOnly()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.isReadOnly();
}
void SimpleRegistry::mergeKey(
OUString const & aKeyName, OUString const & aUrl)
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegistryKey root;
RegError err = registry_.openRootKey(root);
if (err == RegError::NO_ERROR) {
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)
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx
index 396a90322a65..bc588f9dfe1c 100644
--- a/svtools/source/config/itemholder2.cxx
+++ b/svtools/source/config/itemholder2.cxx
@@ -86,7 +86,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 )
{
@@ -106,7 +106,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/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 43a1d68544f5..7f8a591567b3 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -127,7 +127,7 @@ static bool gbAllowAA = false;
bool IsAAPossibleOnThisSystem()
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!gbAllowAAInit)
{
gbAllowAAInit = true;
@@ -141,7 +141,7 @@ bool IsAntiAliasing()
{
bool bAntiAliasing;
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!gbAntiAliasingInit)
{
gbAntiAliasingInit = true;
@@ -159,7 +159,7 @@ bool IsAntiAliasing()
*/
void SetAntiAliasing( bool bOn, bool bTemporary )
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!bTemporary)
{
std::shared_ptr<comphelper::ConfigurationChanges> batch =
diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx
index e4faadfffc25..1fb8b613eb09 100644
--- a/svtools/source/control/asynclink.cxx
+++ b/svtools/source/control/asynclink.cxx
@@ -37,7 +37,7 @@ void AsynchronLink::Call( void* pObj, bool bAllowDoubles )
_pArg = pObj;
DBG_ASSERT( bAllowDoubles || !_nEventId, "Already made a call" );
ClearPendingCall();
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
_nEventId = Application::PostUserEvent( LINK( this, AsynchronLink, HandleCall_PostUserEvent) );
}
@@ -53,7 +53,7 @@ AsynchronLink::~AsynchronLink()
void AsynchronLink::ClearPendingCall()
{
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
if( _nEventId )
{
Application::RemoveUserEvent( _nEventId );
@@ -64,7 +64,7 @@ void AsynchronLink::ClearPendingCall()
IMPL_LINK_NOARG( AsynchronLink, HandleCall_PostUserEvent, void*, void )
{
{
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
_nEventId = nullptr;
// need to release the lock before calling the client since
// the client may call back into us
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 61940085eff1..6fee437ead94 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -155,7 +155,7 @@ void SvtMatchContext_Impl::Stop()
css::uno::Reference< css::ucb::XCommandProcessor > proc;
sal_Int32 id(0);
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (!stopped_) {
stopped_ = true;
proc = processor_;
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG( SvtMatchContext_Impl, Select_Impl, void*, void )
{
// avoid recursion through cancel button
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (stopped_) {
// Completion was stopped, no display:
return;
@@ -403,7 +403,7 @@ void SvtMatchContext_Impl::doExecute()
::osl::MutexGuard aGuard( theSvtMatchContextMutex::get() );
{
// have we been stopped while we were waiting for the mutex?
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (stopped_) {
return;
}
@@ -478,7 +478,7 @@ void SvtMatchContext_Impl::doExecute()
sal_Int32 id = proc->createCommandIdentifier();
try {
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
processor_ = proc;
commandId_ = id;
}
@@ -503,7 +503,7 @@ void SvtMatchContext_Impl::doExecute()
proc2->releaseCommandIdentifier(id);
}
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
processor_.clear();
// At least the neon-based WebDAV UCP does not
// properly support aborting commands, so return
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index bca32029f785..7c12373f5982 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -73,7 +73,7 @@ ValueItemAcc::~ValueItemAcc()
void ValueItemAcc::ParentDestroyed()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
mpParent = nullptr;
}
@@ -261,7 +261,7 @@ lang::Locale SAL_CALL ValueItemAcc::getLocale()
void SAL_CALL ValueItemAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( !rxListener.is() )
return;
@@ -284,7 +284,7 @@ void SAL_CALL ValueItemAcc::addAccessibleEventListener( const uno::Reference< ac
void SAL_CALL ValueItemAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( rxListener.is() )
{
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index f1753226aa71..2b84f8f32404 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -109,7 +109,7 @@ namespace accessibility
void SetOffset( const Point& );
Point GetOffset() const
{
- std::lock_guard aGuard( maMutex ); Point aPoint( maOffset );
+ std::scoped_lock aGuard( maMutex ); Point aPoint( maOffset );
return aPoint;
}
@@ -732,7 +732,7 @@ namespace accessibility
{
// guard against non-atomic access to maOffset data structure
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
maOffset = rPoint;
}
@@ -1383,7 +1383,7 @@ namespace accessibility
// -- object locked --
AccessibleEventObject aEvent;
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
DBG_ASSERT(mxFrontEnd.is(), "AccessibleTextHelper::FireEvent: no event source set");
diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx
index e5e76229907d..63634179142e 100644
--- a/svx/source/form/ParseContext.cxx
+++ b/svx/source/form/ParseContext.cxx
@@ -173,7 +173,7 @@ namespace
OParseContextClient::OParseContextClient()
{
- std::lock_guard aGuard( getSafetyMutex() );
+ std::scoped_lock aGuard( getSafetyMutex() );
++s_nCounter;
if ( 1 == s_nCounter )
{ // first instance
@@ -184,7 +184,7 @@ OParseContextClient::OParseContextClient()
OParseContextClient::~OParseContextClient()
{
- std::lock_guard aGuard( getSafetyMutex() );
+ std::scoped_lock aGuard( getSafetyMutex() );
--s_nCounter;
if ( 0 == s_nCounter )
delete getSharedContext(nullptr,true);
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index e8e0a5e1a328..9263651ff2ef 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -235,7 +235,7 @@ FmXDisposeListener::~FmXDisposeListener()
void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter)
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_pAdapter = pAdapter;
}
diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
index 3612326f2307..6376fa796086 100644
--- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
+++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
@@ -33,7 +33,7 @@ namespace drawinglayer::primitive2d
static basegfx::BColor aBColor;
static std::mutex aMutex;
- std::lock_guard aGuard(aMutex);
+ std::scoped_lock aGuard(aMutex);
if(!aRetVal.get() || rBColor != aBColor)
{
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index c58c60527d21..ad9445e4c7f0 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -101,19 +101,19 @@ SvStream *OutputStorageWrapper_Impl::GetStream()
void SAL_CALL OutputStorageWrapper_Impl::writeBytes(
const Sequence< sal_Int8 >& aData)
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
xOut->writeBytes( aData );
}
void SAL_CALL OutputStorageWrapper_Impl::flush()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
xOut->flush();
}
void SAL_CALL OutputStorageWrapper_Impl::closeOutput()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
xOut->closeOutput();
bStreamClosed = true;
}
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index b59c8036f621..d79f4eb5caef 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -127,7 +127,7 @@ bool SwAccessibleCell::InvalidateMyCursorPos()
bool bNew = IsSelected();
bool bOld;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bOld = m_bIsSelected;
m_bIsSelected = bNew;
}
@@ -227,7 +227,7 @@ void SwAccessibleCell::InvalidateCursorPos_()
bool SwAccessibleCell::HasCursor()
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
return m_bIsSelected;
}
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 0f46a494f844..dde550ef2b9e 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -66,7 +66,7 @@ void SwAccessibleContext::InitStates()
void SwAccessibleContext::SetParent( SwAccessibleContext *pParent )
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
uno::Reference < XAccessible > xParent( pParent );
m_xWeakParent = xParent;
@@ -74,7 +74,7 @@ void SwAccessibleContext::SetParent( SwAccessibleContext *pParent )
uno::Reference< XAccessible > SwAccessibleContext::GetWeakParent() const
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
uno::Reference< XAccessible > xParent( m_xWeakParent );
return xParent;
@@ -270,7 +270,7 @@ void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
bool bIsOldShowingState;
bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bIsOldShowingState = m_isShowingState;
m_isShowingState = bIsNewShowingState;
}
@@ -513,7 +513,7 @@ bool SwAccessibleContext::IsEditableState()
{
bool bRet;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bRet = m_isEditableState;
}
@@ -676,7 +676,7 @@ uno::Reference< XAccessible> SwAccessibleContext::getAccessibleParentImpl()
// Remember the parent as weak ref.
{
- std::lock_guard aWeakParentGuard( m_Mutex );
+ std::scoped_lock aWeakParentGuard( m_Mutex );
m_xWeakParent = xAcc;
}
@@ -1089,7 +1089,7 @@ void SwAccessibleContext::Dispose(bool bRecursive, bool bCanSkipInvisible)
// set defunc state (it's not required to broadcast a state changed
// event if the object is disposed afterwards)
{
- std::lock_guard aDefuncStateGuard( m_Mutex );
+ std::scoped_lock aDefuncStateGuard( m_Mutex );
m_isDefuncState = true;
}
@@ -1160,7 +1160,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
bool bIsOldShowingState;
bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
- std::lock_guard aShowingStateGuard( m_Mutex );
+ std::scoped_lock aShowingStateGuard( m_Mutex );
bIsOldShowingState = m_isShowingState;
m_isShowingState = bIsNewShowingState;
}
@@ -1319,7 +1319,7 @@ void SwAccessibleContext::InvalidateStates( AccessibleStates _nStates )
bool bIsOldEditableState;
bool bIsNewEditableState = IsEditable( pVSh );
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bIsOldEditableState = m_isEditableState;
m_isEditableState = bIsNewEditableState;
}
@@ -1333,7 +1333,7 @@ void SwAccessibleContext::InvalidateStates( AccessibleStates _nStates )
bool bIsOldOpaqueState;
bool bIsNewOpaqueState = IsOpaque( pVSh );
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bIsOldOpaqueState = m_isOpaqueState;
m_isOpaqueState = bIsNewOpaqueState;
}
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index a18364693f74..d2c7aac44a9e 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -141,7 +141,7 @@ void SwAccessibleFrameBase::InvalidateCursorPos_()
bool bOldSelected;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bOldSelected = m_bIsSelected;
m_bIsSelected = bNewSelected;
}
@@ -188,7 +188,7 @@ void SwAccessibleFrameBase::InvalidateFocus_()
bool bSelected;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bSelected = m_bIsSelected;
}
assert(bSelected && "focus object should be selected");
@@ -199,7 +199,7 @@ void SwAccessibleFrameBase::InvalidateFocus_()
bool SwAccessibleFrameBase::HasCursor()
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
return m_bIsSelected;
}
diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx
index c9228ea137cf..a22b01970e1e 100644
--- a/sw/source/core/access/accpage.cxx
+++ b/sw/source/core/access/accpage.cxx
@@ -66,7 +66,7 @@ void SwAccessiblePage::InvalidateCursorPos_()
bool bOldSelected;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bOldSelected = m_bIsSelected;
m_bIsSelected = bNewSelected;
}
@@ -96,7 +96,7 @@ void SwAccessiblePage::InvalidateFocus_()
bool bSelected;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bSelected = m_bIsSelected;
}
OSL_ENSURE( bSelected, "focus object should be selected" );
@@ -125,7 +125,7 @@ SwAccessiblePage::~SwAccessiblePage()
bool SwAccessiblePage::HasCursor()
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
return m_bIsSelected;
}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 36a721eb1c64..24b3b81d005d 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -287,7 +287,7 @@ void SwAccessibleParagraph::InvalidateContent_( bool bVisibleDataFired )
m_nHeadingLevel = GetRealHeadingLevel();
bool bOldIsHeading;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
bOldIsHeading = m_bIsHeading;
if( m_bIsHeading != bNewIsHeading )
m_bIsHeading = bNewIsHeading;
@@ -308,7 +308,7 @@ void SwAccessibleParagraph::InvalidateContent_( bool bVisibleDataFired )
OUString sNewDesc( GetDescription() );
OUString sOldDesc;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
sOldDesc = m_sDesc;
if( m_sDesc != sNewDesc )
m_sDesc = sNewDesc;
@@ -332,7 +332,7 @@ void SwAccessibleParagraph::InvalidateCursorPos_()
sal_Int32 nNew = GetCaretPos();
sal_Int32 nOld;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
nOld = m_nOldCaretPos;
m_nOldCaretPos = nNew;
}
@@ -383,7 +383,7 @@ void SwAccessibleParagraph::InvalidateFocus_()
{
sal_Int32 nPos;
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
nPos = m_nOldCaretPos;
}
OSL_ENSURE( nPos != -1, "focus object should be selected" );
@@ -428,7 +428,7 @@ SwAccessibleParagraph::~SwAccessibleParagraph()
bool SwAccessibleParagraph::HasCursor()
{
- std::lock_guard aGuard( m_Mutex );
+ std::scoped_lock aGuard( m_Mutex );
return m_nOldCaretPos != -1;
}
@@ -707,7 +707,7 @@ OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription()
ThrowIfDisposed();
- std::lock_guard aGuard2( m_Mutex );
+ std::scoped_lock aGuard2( m_Mutex );
if( m_sDesc.isEmpty() )
m_sDesc = GetDescription();
@@ -1016,7 +1016,7 @@ sal_Int32 SwAccessibleParagraph::getCaretPosition()
sal_Int32 nRet = GetCaretPos();
{
- std::lock_guard aOldCaretPosGuard( m_Mutex );
+ std::scoped_lock aOldCaretPosGuard( m_Mutex );
OSL_ENSURE( nRet == m_nOldCaretPos, "caret pos out of sync" );
m_nOldCaretPos = nRet;
}
diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx
index 66483cd77449..4bfc84132e61 100644
--- a/sw/source/core/docnode/finalthreadmanager.cxx
+++ b/sw/source/core/docnode/finalthreadmanager.cxx
@@ -67,7 +67,7 @@ class CancelJobsThread : public osl::Thread
void CancelJobsThread::addJobs( std::list< css::uno::Reference< css::util::XCancellable > >& rJobs )
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
maJobs.insert( maJobs.end(), rJobs.begin(), rJobs.end() );
mbAllJobsCancelled = !maJobs.empty();
@@ -75,21 +75,21 @@ void CancelJobsThread::addJobs( std::list< css::uno::Reference< css::util::XCanc
bool CancelJobsThread::existJobs() const
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
return !maJobs.empty();
}
bool CancelJobsThread::allJobsCancelled() const
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
return maJobs.empty() && mbAllJobsCancelled;
}
void CancelJobsThread::stopWhenAllJobsCancelled()
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
mbStopped = true;
}
@@ -99,7 +99,7 @@ css::uno::Reference< css::util::XCancellable > CancelJobsThread::getNextJob()
css::uno::Reference< css::util::XCancellable > xRet;
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
if ( !maJobs.empty() )
{
@@ -113,7 +113,7 @@ css::uno::Reference< css::util::XCancellable > CancelJobsThread::getNextJob()
bool CancelJobsThread::stopped() const
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
return mbStopped;
}
diff --git a/unotools/source/accessibility/accessiblerelationsethelper.cxx b/unotools/source/accessibility/accessiblerelationsethelper.cxx
index e7bf704a300b..323b12c53506 100644
--- a/unotools/source/accessibility/accessiblerelationsethelper.cxx
+++ b/unotools/source/accessibility/accessiblerelationsethelper.cxx
@@ -66,7 +66,7 @@ AccessibleRelationSetHelper::~AccessibleRelationSetHelper()
sal_Int32 SAL_CALL
AccessibleRelationSetHelper::getRelationCount( )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return maRelations.size();
}
@@ -87,7 +87,7 @@ sal_Int32 SAL_CALL
AccessibleRelation SAL_CALL
AccessibleRelationSetHelper::getRelation( sal_Int32 nIndex )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= maRelations.size()))
throw lang::IndexOutOfBoundsException();
@@ -110,7 +110,7 @@ sal_Int32 SAL_CALL
sal_Bool SAL_CALL
AccessibleRelationSetHelper::containsRelation( sal_Int16 aRelationType )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
AccessibleRelation defaultRelation; // default is INVALID
AccessibleRelation relationByType = lcl_getRelationByType(maRelations, aRelationType);
@@ -131,14 +131,14 @@ sal_Bool SAL_CALL
AccessibleRelation SAL_CALL
AccessibleRelationSetHelper::getRelationByType( sal_Int16 aRelationType )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return lcl_getRelationByType(maRelations, aRelationType);
}
void AccessibleRelationSetHelper::AddRelation(const AccessibleRelation& rRelation)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
for (auto& aRelation: maRelations)
{
diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx b/unotools/source/accessibility/accessiblestatesethelper.cxx
index db725d079a06..1c3ccc8ff6de 100644
--- a/unotools/source/accessibility/accessiblestatesethelper.cxx
+++ b/unotools/source/accessibility/accessiblestatesethelper.cxx
@@ -70,7 +70,7 @@ AccessibleStateSetHelper::~AccessibleStateSetHelper()
*/
sal_Bool SAL_CALL AccessibleStateSetHelper::isEmpty ()
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return maStates == 0;
}
@@ -87,7 +87,7 @@ sal_Bool SAL_CALL AccessibleStateSetHelper::isEmpty ()
*/
sal_Bool SAL_CALL AccessibleStateSetHelper::contains (sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return lcl_contains(maStates, aState);
}
@@ -110,14 +110,14 @@ sal_Bool SAL_CALL AccessibleStateSetHelper::contains (sal_Int16 aState)
sal_Bool SAL_CALL AccessibleStateSetHelper::containsAll
(const uno::Sequence<sal_Int16>& rStateSet)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return std::all_of(rStateSet.begin(), rStateSet.end(),
[this](const sal_Int16 nState) { return lcl_contains(maStates, nState); });
}
uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSetHelper::getStates()
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
uno::Sequence<sal_Int16> aRet(BITFIELDSIZE);
sal_Int16* pSeq = aRet.getArray();
sal_Int16 nStateCount(0);
@@ -134,7 +134,7 @@ uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSetHelper::getStates()
void AccessibleStateSetHelper::AddState(sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small");
sal_uInt64 aTempBitSet(1);
aTempBitSet <<= aState;
@@ -143,7 +143,7 @@ void AccessibleStateSetHelper::AddState(sal_Int16 aState)
void AccessibleStateSetHelper::RemoveState(sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small");
sal_uInt64 aTempBitSet(1);
aTempBitSet <<= aState;
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 7870e63ae888..5931026995ac 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -86,7 +86,7 @@ void SAL_CALL ItemHolder1::disposing(const css::lang::EventObject&)
void ItemHolder1::impl_addItem(EItem eItem)
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
for ( auto const & rInfo : m_lItems )
{
@@ -105,7 +105,7 @@ void ItemHolder1::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/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index 7c1c2b92d4c4..c326e4315681 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -53,13 +53,13 @@ CharClass::~CharClass()
void CharClass::setLanguageTag( const LanguageTag& rLanguageTag )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
maLanguageTag = rLanguageTag;
}
const LanguageTag& CharClass::getLanguageTag() const
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return maLanguageTag;
}
@@ -115,7 +115,7 @@ bool CharClass::isAlpha( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
nCharClassAlphaType) != 0;
}
@@ -137,7 +137,7 @@ bool CharClass::isLetter( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
nCharClassLetterType) != 0;
}
@@ -155,7 +155,7 @@ bool CharClass::isLetter( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isLetterType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -176,7 +176,7 @@ bool CharClass::isDigit( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
KCharacterType::DIGIT) != 0;
}
@@ -194,7 +194,7 @@ bool CharClass::isNumeric( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -215,7 +215,7 @@ bool CharClass::isAlphaNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
(nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
}
@@ -237,7 +237,7 @@ bool CharClass::isLetterNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
(nCharClassLetterType | KCharacterType::DIGIT)) != 0;
}
@@ -255,7 +255,7 @@ bool CharClass::isLetterNumeric( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -272,7 +272,7 @@ OUString CharClass::titlecase(const OUString& rStr, sal_Int32 nPos, sal_Int32 nC
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toTitle( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -289,7 +289,7 @@ OUString CharClass::uppercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toUpper( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -306,7 +306,7 @@ OUString CharClass::lowercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toLower( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -323,7 +323,7 @@ sal_Int16 CharClass::getType( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getType( rStr, nPos );
}
}
@@ -340,7 +340,7 @@ css::i18n::DirectionProperty CharClass::getCharacterDirection( const OUString& r
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return static_cast<css::i18n::DirectionProperty>(xCC->getCharacterDirection( rStr, nPos ));
}
}
@@ -357,7 +357,7 @@ css::i18n::UnicodeScript CharClass::getScript( const OUString& rStr, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return static_cast<css::i18n::UnicodeScript>(xCC->getScript( rStr, nPos ));
}
}
@@ -374,7 +374,7 @@ sal_Int32 CharClass::getCharacterType( const OUString& rStr, sal_Int32 nPos ) co
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getCharacterType( rStr, nPos, getMyLocale() );
}
}
@@ -391,7 +391,7 @@ sal_Int32 CharClass::getStringType( const OUString& rStr, sal_Int32 nPos, sal_In
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getStringType( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -414,7 +414,7 @@ css::i18n::ParseResult CharClass::parseAnyToken(
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->parseAnyToken( rStr, nPos, getMyLocale(),
nStartCharFlags, userDefinedCharactersStart,
nContCharFlags, userDefinedCharactersCont );
@@ -440,7 +440,7 @@ css::i18n::ParseResult CharClass::parsePredefinedToken(
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->parsePredefinedToken( nTokenType, rStr, nPos, getMyLocale(),
nStartCharFlags, userDefinedCharactersStart,
nContCharFlags, userDefinedCharactersCont );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 38c089f7c835..ba75b0b2319b 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -104,7 +104,7 @@ Reference<XTextSearch2> TextSearch::getXTextSearch( const i18nutil::SearchOption
{
static CachedTextSearch theCachedTextSearch;
- std::lock_guard aGuard(theCachedTextSearch.mutex);
+ std::scoped_lock aGuard(theCachedTextSearch.mutex);
if ( lcl_Equals(theCachedTextSearch.Options, rPara) )
return theCachedTextSearch.xTextSearch;
diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx
index bd8824d9456f..63820352179d 100644
--- a/unotools/source/streaming/streamhelper.cxx
+++ b/unotools/source/streaming/streamhelper.cxx
@@ -36,7 +36,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
if (nBytesToRead < 0)
throw css::io::BufferSizeExceededException(OUString(), static_cast<css::uno::XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -56,7 +56,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
void SAL_CALL OInputStreamHelper::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_nActPos = location;
}
@@ -70,7 +70,7 @@ sal_Int64 SAL_CALL OInputStreamHelper::getLength( )
if (!m_xLockBytes.is())
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
SvLockBytesStat aStat;
m_xLockBytes->Stat( &aStat );
return aStat.nSize;
@@ -85,7 +85,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readSomeBytes(css::uno::Sequence< sal_Int
void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -97,7 +97,7 @@ void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OInputStreamHelper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -106,7 +106,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::available()
void SAL_CALL OInputStreamHelper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
index 77e7168d69a2..9a9b53d1f1ec 100644
--- a/unotools/source/streaming/streamwrap.cxx
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -63,7 +63,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 >
if (nBytesToRead < 0)
throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -96,7 +96,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(css::uno::Sequence< sal_In
void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkError();
m_pSvStream->SeekRel(nBytesToSkip);
@@ -105,7 +105,7 @@ void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OInputStreamWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_Int64 nAvailable = m_pSvStream->remainingSize();
@@ -116,7 +116,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::available()
void SAL_CALL OInputStreamWrapper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
if (m_bSvStreamOwner)
@@ -157,7 +157,7 @@ OSeekableInputStreamWrapper::OSeekableInputStreamWrapper(SvStream* _pStream, boo
void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
@@ -166,7 +166,7 @@ void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation )
sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_uInt32 nPos = m_pSvStream->Tell();
@@ -176,7 +176,7 @@ sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition( )
sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
checkError();
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 1afa874d49f8..7394f106bd4f 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -308,7 +308,7 @@ public:
virtual Reference<XStream> SAL_CALL getStream () override
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_xStream;
}
@@ -334,7 +334,7 @@ public:
virtual Reference<XInputStream> SAL_CALL getInputStream() override
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_xStream;
}
@@ -358,7 +358,7 @@ ModeratorsActiveDataSink::setInputStream (
)
{
m_aModerator.setInputStream(rxInputStream);
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_xStream = rxInputStream;
}
@@ -376,7 +376,7 @@ ModeratorsActiveDataStreamer::setStream (
)
{
m_aModerator.setStream(rxStream);
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_xStream = rxStream;
}
diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx
index b40a7347ea08..3da15ee7d7e9 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -129,7 +129,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CDocumentBuilder::newDocument()
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// create a new document
xmlDocPtr pDocument = xmlNewDoc(reinterpret_cast<const xmlChar*>("1.0"));
@@ -333,7 +333,7 @@ namespace DOM
throw RuntimeException();
}
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// IO context struct. Must outlive pContext, as destroying that via
// xmlFreeParserCtxt may still access this context_t
@@ -364,7 +364,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CDocumentBuilder::parseURI(const OUString& sUri)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
std::unique_ptr<xmlParserCtxt, XmlFreeParserCtxt> const pContext(
xmlNewParserCtxt());
@@ -403,14 +403,14 @@ namespace DOM
void SAL_CALL
CDocumentBuilder::setEntityResolver(Reference< XEntityResolver > const& xER)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_xEntityResolver = xER;
}
Reference< XEntityResolver > CDocumentBuilder::getEntityResolver()
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
return m_xEntityResolver;
}
@@ -418,7 +418,7 @@ namespace DOM
void SAL_CALL
CDocumentBuilder::setErrorHandler(Reference< XErrorHandler > const& xEH)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_xErrorHandler = xEH;
}
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index ab174e3052cd..43dd54ed3130 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -55,14 +55,14 @@ namespace DOM
SAXDocumentBuilderState SAL_CALL CSAXDocumentBuilder::getState()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
return m_aState;
}
void SAL_CALL CSAXDocumentBuilder::reset()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
m_aDocument.clear();
m_aFragment.clear();
@@ -72,7 +72,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CSAXDocumentBuilder::getDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if (m_aState != SAXDocumentBuilderState_DOCUMENT_FINISHED)
throw RuntimeException();
@@ -82,7 +82,7 @@ namespace DOM
Reference< XDocumentFragment > SAL_CALL CSAXDocumentBuilder::getDocumentFragment()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if (m_aState != SAXDocumentBuilderState_FRAGMENT_FINISHED)
throw RuntimeException();
@@ -91,7 +91,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::startDocumentFragment(const Reference< XDocument >& ownerDoc)
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// start a new document fragment and push it onto the stack
// we have to be in a clean state to do this
@@ -107,7 +107,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endDocumentFragment()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// there should only be the document left on the node stack
if (m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -123,7 +123,7 @@ namespace DOM
//XFastDocumentHandler
void SAL_CALL CSAXDocumentBuilder::startDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// start a new document and push it onto the stack
// we have to be in a clean state to do this
@@ -139,7 +139,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// there should only be the document left on the node stack
if (m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT)
@@ -154,7 +154,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::processingInstruction( const OUString& rTarget, const OUString& rData )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// append PI node to the current top
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -172,7 +172,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::startFastElement( sal_Int32 nElement , const Reference< XFastAttributeList >& xAttribs )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -208,7 +208,7 @@ namespace DOM
// For arbitrary meta elements
void SAL_CALL CSAXDocumentBuilder::startUnknownElement( const OUString& rNamespace, const OUString& rName, const Reference< XFastAttributeList >& xAttribs )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -262,7 +262,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endFastElement( sal_Int32 nElement )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// pop the current element from the stack
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -285,7 +285,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endUnknownElement( const OUString& /*rNamespace*/, const OUString& rName )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// pop the current element from the stack
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -323,7 +323,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::characters( const OUString& rChars )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// append text node to the current top element
if (m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 881fee7636ab..b3854d65a267 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -443,7 +443,7 @@ public:
virtual ~librdf_GraphResult() override
{
- std::lock_guard g(m_rMutex); // lock mutex when destroying members
+ std::scoped_lock g(m_rMutex); // lock mutex when destroying members
const_cast<std::shared_ptr<librdf_stream>& >(m_pStream).reset();
const_cast<std::shared_ptr<librdf_node>& >(m_pContext).reset();
const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset();
@@ -479,7 +479,7 @@ private:
sal_Bool SAL_CALL
librdf_GraphResult::hasMoreElements()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
return m_pStream && !librdf_stream_end(m_pStream.get());
}
@@ -501,7 +501,7 @@ librdf_node* librdf_GraphResult::getContext_Lock() const
css::uno::Any SAL_CALL
librdf_GraphResult::nextElement()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
if (m_pStream && librdf_stream_end(m_pStream.get())) {
throw container::NoSuchElementException();
}
@@ -594,7 +594,7 @@ public:
virtual ~librdf_QuerySelectResult() override
{
- std::lock_guard g(m_rMutex); // lock mutex when destroying members
+ std::scoped_lock g(m_rMutex); // lock mutex when destroying members
const_cast<std::shared_ptr<librdf_query_results>& >(m_pQueryResult)
.reset();
const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset();
@@ -630,7 +630,7 @@ private:
sal_Bool SAL_CALL
librdf_QuerySelectResult::hasMoreElements()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
return !librdf_query_results_finished(m_pQueryResult.get());
}
@@ -651,7 +651,7 @@ public:
css::uno::Any SAL_CALL
librdf_QuerySelectResult::nextElement()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
if (librdf_query_results_finished(m_pQueryResult.get())) {
throw container::NoSuchElementException();
}
@@ -883,7 +883,7 @@ librdf_Repository::librdf_Repository(
{
OSL_ENSURE(i_xContext.is(), "librdf_Repository: null context");
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
if (!m_NumInstances++) {
m_pWorld.reset(m_TypeConverter.createWorld_Lock(),
safe_librdf_free_world);
@@ -892,7 +892,7 @@ librdf_Repository::librdf_Repository(
librdf_Repository::~librdf_Repository()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
// must destroy these before world!
m_pModel.reset();
@@ -929,7 +929,7 @@ librdf_Repository::getSupportedServiceNames()
// css::rdf::XRepository:
uno::Reference< rdf::XBlankNode > SAL_CALL librdf_Repository::createBlankNode()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const std::shared_ptr<librdf_node> pNode(
librdf_new_node_from_blank_identifier(m_pWorld.get(), nullptr),
safe_librdf_free_node);
@@ -1001,7 +1001,7 @@ librdf_Repository::importGraph(::sal_Int16 i_Format,
// exceptions are propagated
i_xInStream->readBytes( buf, static_cast<sal_Int32>( sz ) );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (m_NamedGraphs.find(contextU) != m_NamedGraphs.end()) {
throw container::ElementExistException(
@@ -1253,7 +1253,7 @@ librdf_Repository::exportGraph(::sal_Int16 i_Format,
uno::Sequence< uno::Reference< rdf::XURI > > SAL_CALL
librdf_Repository::getGraphNames()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
::std::vector< uno::Reference<rdf::XURI> > ret;
std::transform(m_NamedGraphs.begin(), m_NamedGraphs.end(),
std::back_inserter(ret),
@@ -1271,7 +1271,7 @@ librdf_Repository::getGraph(const uno::Reference< rdf::XURI > & i_xGraphName)
}
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const NamedGraphMap_t::iterator iter( m_NamedGraphs.find(contextU) );
if (iter != m_NamedGraphs.end()) {
return iter->second;
@@ -1295,7 +1295,7 @@ librdf_Repository::createGraph(const uno::Reference< rdf::XURI > & i_xGraphName)
"librdf_Repository::createGraph: URI is reserved", *this, 0);
}
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
// NB: librdf does not have a concept of graphs as such;
// a librdf named graph exists iff the model contains a statement with
@@ -1320,7 +1320,7 @@ librdf_Repository::destroyGraph(
}
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const NamedGraphMap_t::iterator iter( clearGraph_Lock(contextU, false) );
m_NamedGraphs.erase(iter);
@@ -1352,7 +1352,7 @@ librdf_Repository::getStatements(
librdf_TypeConverter::extractStatement_NoLock(
i_xSubject, i_xPredicate, i_xObject));
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const std::shared_ptr<librdf_statement> pStatement(
librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt),
@@ -1376,7 +1376,7 @@ librdf_Repository::getStatements(
uno::Reference< rdf::XQuerySelectResult > SAL_CALL
librdf_Repository::querySelect(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
const std::shared_ptr<librdf_query> pQuery(
@@ -1422,7 +1422,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery)
uno::Reference< container::XEnumeration > SAL_CALL
librdf_Repository::queryConstruct(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
const std::shared_ptr<librdf_query> pQuery(
@@ -1458,7 +1458,7 @@ librdf_Repository::queryConstruct(const OUString & i_rQuery)
sal_Bool SAL_CALL
librdf_Repository::queryAsk(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
@@ -1572,7 +1572,7 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
removeStatementRDFa(i_xObject); // not atomic with insertion?
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (i_rRDFaContent.isEmpty()) {
m_RDFaXHTMLContentSet.erase(sXmlId);
@@ -1655,7 +1655,7 @@ librdf_Repository::getStatementRDFa(
"cannot getStatementsGraph", *this, anyEx);
}
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
return beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool >(
comphelper::containerToSequence(ret), 0 != m_RDFaXHTMLContentSet.count(sXmlId));
@@ -1700,7 +1700,7 @@ librdf_Repository::getStatementsRDFa(
librdf_TypeConverter::extractStatement_NoLock(
i_xSubject, i_xPredicate, i_xObject));
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const std::shared_ptr<librdf_statement> pStatement(
librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt),
@@ -1731,7 +1731,7 @@ librdf_Repository::getStatementsRDFa(
void SAL_CALL librdf_Repository::initialize(
const uno::Sequence< css::uno::Any > &)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
// m_pWorld.reset(m_TypeConverter.createWorld(), safe_librdf_free_world);
m_pStorage.reset(m_TypeConverter.createStorage_Lock(m_pWorld.get()),
@@ -1745,7 +1745,7 @@ NamedGraphMap_t::iterator librdf_Repository::clearGraph_NoLock(
// throw (uno::RuntimeException, container::NoSuchElementException,
// rdf::RepositoryException)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
return clearGraph_Lock(i_rGraphName, i_Internal);
}
@@ -1809,7 +1809,7 @@ void librdf_Repository::addStatementGraph_NoLock(
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
addStatementGraph_Lock(stmt, contextU, false/*i_Internal*/);
}
@@ -1883,7 +1883,7 @@ void librdf_Repository::removeStatementsGraph_NoLock(
i_xSubject, i_xPredicate, i_xObject));
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (m_NamedGraphs.find(contextU) == m_NamedGraphs.end()) {
throw container::NoSuchElementException(
@@ -1964,7 +1964,7 @@ librdf_Repository::getStatementsGraph_NoLock(
i_xSubject, i_xPredicate, i_xObject));
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (!i_Internal && (m_NamedGraphs.find(contextU) == m_NamedGraphs.end())) {
throw container::NoSuchElementException(
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 88f1d37c5d8c..28c733490b04 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -72,7 +72,7 @@ namespace XPath
const OUString& aPrefix,
const OUString& aURI)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_nsmap.emplace(aPrefix, aURI);
}
@@ -81,7 +81,7 @@ namespace XPath
const OUString& aPrefix,
const OUString& aURI)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
if ((m_nsmap.find(aPrefix))->second == aURI) {
m_nsmap.erase(aPrefix);
@@ -284,7 +284,7 @@ namespace XPath
extensions_t extensions;
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
nsmap = m_nsmap;
extensions = m_extensions;
}
@@ -365,7 +365,7 @@ namespace XPath
void SAL_CALL CXPathAPI::registerExtension(
const OUString& aName)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// get extension from service manager
Reference< XXPathExtension > const xExtension(
@@ -383,7 +383,7 @@ namespace XPath
if (!xExtension.is()) {
throw RuntimeException();
}
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_extensions.push_back( xExtension );
}
}
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index d631527af6e0..c3f4e2ac6310 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -101,7 +101,7 @@ OUString extractActionType(const ActionDataMap& rData)
void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow,
std::unique_ptr<ActionDataMap> pData)
{
- std::lock_guard aGuard(m_aQueueMutex);
+ std::scoped_lock aGuard(m_aQueueMutex);
// we want only the latest update of same type
// TODO: also if we met full update - previous updates are not valid
@@ -261,7 +261,7 @@ void JSDialogNotifyIdle::Invoke()
{
std::deque<JSDialogMessageInfo> aMessageQueue;
{
- std::lock_guard aGuard(m_aQueueMutex);
+ std::scoped_lock aGuard(m_aQueueMutex);
std::swap(aMessageQueue, m_aMessageQueue);
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 55238a09729f..b0ee96a0e54c 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -325,7 +325,7 @@ GraphicFilter::GraphicFilter( bool bConfig )
GraphicFilter::~GraphicFilter()
{
{
- std::lock_guard aGuard( getListMutex() );
+ std::scoped_lock aGuard( getListMutex() );
auto it = std::find(gaFilterHdlList.begin(), gaFilterHdlList.end(), this);
if( it != gaFilterHdlList.end() )
gaFilterHdlList.erase( it );
@@ -340,7 +340,7 @@ GraphicFilter::~GraphicFilter()
void GraphicFilter::ImplInit()
{
{
- std::lock_guard aGuard( getListMutex() );
+ std::scoped_lock aGuard( getListMutex() );
if ( gaFilterHdlList.empty() )
pConfig = new FilterConfigCache( bUseConfig );
diff --git a/vcl/source/graphic/UnoGraphicObject.cxx b/vcl/source/graphic/UnoGraphicObject.cxx
index 69cbd6daa048..978983715a1c 100644
--- a/vcl/source/graphic/UnoGraphicObject.cxx
+++ b/vcl/source/graphic/UnoGraphicObject.cxx
@@ -71,7 +71,7 @@ GraphicObjectImpl::GraphicObjectImpl(const uno::Sequence<uno::Any>& /*rArgs*/)
uno::Reference<graphic::XGraphic> SAL_CALL GraphicObjectImpl::getGraphic()
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!mpGraphicObject)
throw uno::RuntimeException();
@@ -80,7 +80,7 @@ uno::Reference<graphic::XGraphic> SAL_CALL GraphicObjectImpl::getGraphic()
void SAL_CALL GraphicObjectImpl::setGraphic(uno::Reference<graphic::XGraphic> const & rxGraphic)
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!mpGraphicObject)
throw uno::RuntimeException();
diff --git a/vcl/source/helper/displayconnectiondispatch.cxx b/vcl/source/helper/displayconnectiondispatch.cxx
index 72c3a435a57c..664446cd8812 100644
--- a/vcl/source/helper/displayconnectiondispatch.cxx
+++ b/vcl/source/helper/displayconnectiondispatch.cxx
@@ -56,7 +56,7 @@ void DisplayConnectionDispatch::terminate()
SolarMutexReleaser aRel;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
Any aEvent;
std::vector< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers );
for (auto const& elem : aLocalList)
@@ -65,14 +65,14 @@ void DisplayConnectionDispatch::terminate()
void SAL_CALL DisplayConnectionDispatch::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aHandlers.push_back( handler );
}
void SAL_CALL DisplayConnectionDispatch::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aHandlers.erase( std::remove(m_aHandlers.begin(), m_aHandlers.end(), handler), m_aHandlers.end() );
}
@@ -99,7 +99,7 @@ bool DisplayConnectionDispatch::dispatchEvent( void const * pData, int nBytes )
aEvent <<= aSeq;
::std::vector< css::uno::Reference< XEventHandler > > handlers;
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
handlers = m_aHandlers;
}
for (auto const& handle : handlers)
diff --git a/vcl/source/treelist/transfer2.cxx b/vcl/source/treelist/transfer2.cxx
index 58e217996350..9fdeae5071cc 100644
--- a/vcl/source/treelist/transfer2.cxx
+++ b/vcl/source/treelist/transfer2.cxx
@@ -83,7 +83,7 @@ void DragSourceHelper::dispose()
{
Reference<XDragGestureRecognizer> xTmp;
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
xTmp = std::move(mxDragGestureRecognizer);
}
if( xTmp.is() )
@@ -244,7 +244,7 @@ void DropTargetHelper::dispose()
{
Reference< XDropTarget > xTmp;
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
xTmp = std::move(mxDropTarget);
}
if( xTmp.is() )
diff --git a/vcl/source/window/dndeventdispatcher.cxx b/vcl/source/window/dndeventdispatcher.cxx
index f5083437c5f6..b8190a118fd5 100644
--- a/vcl/source/window/dndeventdispatcher.cxx
+++ b/vcl/source/window/dndeventdispatcher.cxx
@@ -86,7 +86,7 @@ void DNDEventDispatcher::designate_currentwindow(vcl::Window *pWindow)
void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
Point location( dtde.LocationX, dtde.LocationY );
@@ -119,7 +119,7 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtdee )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
Point location( dtdee.LocationX, dtdee.LocationY );
vcl::Window * pChildWindow = findTopLevelWindow(location);
@@ -142,7 +142,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd
void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
fireDragExitEvent( m_pCurrentWindow );
@@ -153,7 +153,7 @@ void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ )
void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
Point location( dtde.LocationX, dtde.LocationY );
sal_Int32 nListeners;
@@ -189,7 +189,7 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& dtde )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
Point location( dtde.LocationX, dtde.LocationY );
sal_Int32 nListeners;
@@ -225,7 +225,7 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent&
void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& dge )
{
- std::lock_guard aImplGuard( m_aMutex );
+ std::scoped_lock aImplGuard( m_aMutex );
Point origin( dge.DragOriginX, dge.DragOriginY );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index d049a67d60c7..4b4286273099 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -535,7 +535,7 @@ OUString PPDParser::getPPDFile( const OUString& rFile )
const PPDParser* PPDParser::getParser( const OUString& rFile )
{
static std::recursive_mutex aMutex;
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
OUString aFile = rFile;
if( !rFile.startsWith( "CUPS:" ) && !rFile.startsWith( "CPD:" ) )
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 75633b3d03ae..0474bc5738fa 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -903,7 +903,7 @@ void SAL_CALL InputStreamTransformer::release() noexcept
sal_Int32 SAL_CALL InputStreamTransformer::readBytes( Sequence< sal_Int8 >& aData,sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
int curr,available_ = buffer.getLength() - pos;
if( nBytesToRead <= available_ )
@@ -929,14 +929,14 @@ sal_Int32 SAL_CALL InputStreamTransformer::readSomeBytes( Sequence< sal_Int8 >&
void SAL_CALL InputStreamTransformer::skipBytes( sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
while( nBytesToSkip-- ) ++pos;
}
sal_Int32 SAL_CALL InputStreamTransformer::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return std::min<sal_Int64>(SAL_MAX_INT32, buffer.getLength() - pos);
}
@@ -948,7 +948,7 @@ void SAL_CALL InputStreamTransformer::closeInput()
void SAL_CALL InputStreamTransformer::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( location < 0 )
throw IllegalArgumentException();
@@ -961,14 +961,14 @@ void SAL_CALL InputStreamTransformer::seek( sal_Int64 location )
sal_Int64 SAL_CALL InputStreamTransformer::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return sal_Int64( pos );
}
sal_Int64 SAL_CALL InputStreamTransformer::getLength()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return buffer.getLength();
}
@@ -976,7 +976,7 @@ sal_Int64 SAL_CALL InputStreamTransformer::getLength()
void InputStreamTransformer::addToBuffer( const char* buffer_,int len_ )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
buffer.append( buffer_, len_ );
}
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index c374b4242585..852101bb52ad 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -1081,7 +1081,7 @@ OUString TreeFileIterator::expandURL( const OUString& aURL )
static Reference< util::XMacroExpander > xMacroExpander;
static Reference< uri::XUriReferenceFactory > xFac;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !xMacroExpander.is() || !xFac.is() )
{
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e877f5b25cbd..889b9243e8d6 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2270,7 +2270,7 @@ void SvXMLExport::SetError(
{
// allow multi-threaded access to the cancel() method
static std::mutex aMutex;
- std::lock_guard aGuard(aMutex);
+ std::scoped_lock aGuard(aMutex);
// maintain error flags
if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
index c714bea9743f..0bfc42b3b6e9 100644
--- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
+++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
@@ -60,7 +60,7 @@ namespace xmlscript
void XMLBasicExporterBase::initialize( const Sequence< Any >& aArguments )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( aArguments.getLength() != 1 )
{
@@ -79,7 +79,7 @@ namespace xmlscript
void XMLBasicExporterBase::setSourceDocument( const Reference< XComponent >& rxDoc )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xModel.set( rxDoc, UNO_QUERY );
@@ -93,7 +93,7 @@ namespace xmlscript
sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /*aDescriptor*/ )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
bool bReturn = true;
@@ -306,7 +306,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
void XMLBasicExporterBase::cancel()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
// cancel export
}
diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
index 4f05dd4b0da9..63c128e7027f 100644
--- a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
@@ -37,7 +37,7 @@ ODigestContext::~ODigestContext()
void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_bBroken )
throw uno::RuntimeException();
@@ -65,7 +65,7 @@ void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& a
uno::Sequence< ::sal_Int8 > SAL_CALL ODigestContext::finalizeDigestAndDispose()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_bBroken )
throw uno::RuntimeException();
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 2f0d878d11db..34dbfabf6068 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -211,7 +211,7 @@ void SecurityEnvironment_NssImpl::adoptSymKey( PK11SymKey* aSymKey ) {
void SecurityEnvironment_NssImpl::updateSlots()
{
//In case new tokens are present then we can obtain the corresponding slot
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
m_Slots.clear();
m_tSymKeyList.clear();