summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2021-05-30 19:32:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-31 15:21:39 +0200
commitd220fc00c2c3d7a2a24fd762599d1bfcc27f34d5 (patch)
tree0936cdc1c063c441bfbb818f00842641714384df
parentcanvas : use std::mutex in CanvasFactory (diff)
downloadcore-d220fc00c2c3d7a2a24fd762599d1bfcc27f34d5.tar.gz
core-d220fc00c2c3d7a2a24fd762599d1bfcc27f34d5.zip
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@collabora.co.uk>
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.cxx9
-rw-r--r--sdext/source/pdfimport/misc/pwdinteract.cxx11
2 files changed, 11 insertions, 9 deletions
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;
}