summaryrefslogtreecommitdiffstats
path: root/cppuhelper
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 /cppuhelper
parentPass context and resource string down to boost::locale separately (diff)
downloadcore-05ab38359ae72f2a54dc0b5f1b84ac5f649c507a.tar.gz
core-05ab38359ae72f2a54dc0b5f1b84ac5f649c507a.zip
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>
Diffstat (limited to 'cppuhelper')
-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
4 files changed, 10 insertions, 10 deletions
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",