[Libreoffice-commits] core.git: sdext/source
Arnaud Versini (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 31 13:22:16 UTC 2021
sdext/source/minimizer/pppoptimizertoken.cxx | 9 +++++----
sdext/source/pdfimport/misc/pwdinteract.cxx | 11 ++++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
New commits:
commit d220fc00c2c3d7a2a24fd762599d1bfcc27f34d5
Author: Arnaud Versini <arnaud.versini at libreoffice.org>
AuthorDate: Sun May 30 19:32:41 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 31 15:21:39 2021 +0200
sdext : use std::mutex when possible
Change-Id: Ia610c0c46e017452db71945f6f53fedbcb6d1198
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116415
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index 9a5c2eac9a62..9130621ff762 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -19,16 +19,17 @@
#include "pppoptimizertoken.hxx"
-#include <osl/mutex.hxx>
+
#include <sal/macros.h>
#include <unordered_map>
#include <memory>
+#include <mutex>
typedef std::unordered_map< const char*, PPPOptimizerTokenEnum, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
static TypeNameHashMap* pHashMap = nullptr;
-static ::osl::Mutex& getHashMapMutex()
+static std::mutex& getHashMapMutex()
{
- static osl::Mutex s_aHashMapProtection;
+ static std::mutex s_aHashMapProtection;
return s_aHashMapProtection;
}
@@ -166,7 +167,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken )
{
if ( !pHashMap )
{ // init hash map
- ::osl::MutexGuard aGuard( getHashMapMutex() );
+ std::lock_guard aGuard( getHashMapMutex() );
if ( !pHashMap )
{
TypeNameHashMap* pH = new TypeNameHashMap;
diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx b/sdext/source/pdfimport/misc/pwdinteract.cxx
index 4179795cc073..9885a6606a54 100644
--- a/sdext/source/pdfimport/misc/pwdinteract.cxx
+++ b/sdext/source/pdfimport/misc/pwdinteract.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <cassert>
+#include <mutex>
#include <pdfihelper.hxx>
@@ -44,7 +45,7 @@ class PDFPasswordRequest:
task::XInteractionRequest, task::XInteractionPassword >
{
private:
- mutable osl::Mutex m_aMutex;
+ mutable std::mutex m_aMutex;
uno::Any m_aRequest;
OUString m_aPassword;
bool m_bSelected;
@@ -65,7 +66,7 @@ public:
// XInteractionContinuation
virtual void SAL_CALL select() override;
- bool isSelected() const { osl::MutexGuard const guard( m_aMutex ); return m_bSelected; }
+ bool isSelected() const { std::scoped_lock const guard( m_aMutex ); return m_bSelected; }
private:
virtual ~PDFPasswordRequest() override {}
@@ -98,21 +99,21 @@ uno::Sequence< uno::Reference< task::XInteractionContinuation > > PDFPasswordReq
void PDFPasswordRequest::setPassword( const OUString& rPwd )
{
- osl::MutexGuard const guard( m_aMutex );
+ std::scoped_lock const guard( m_aMutex );
m_aPassword = rPwd;
}
OUString PDFPasswordRequest::getPassword()
{
- osl::MutexGuard const guard( m_aMutex );
+ std::scoped_lock const guard( m_aMutex );
return m_aPassword;
}
void PDFPasswordRequest::select()
{
- osl::MutexGuard const guard( m_aMutex );
+ std::scoped_lock const guard( m_aMutex );
m_bSelected = true;
}
More information about the Libreoffice-commits
mailing list