summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-05-08 19:45:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-09 10:16:39 +0200
commit9277faf14a713b8ae88596785874bdcdfc47957c (patch)
treee206abd22c2e96814ec90226b74f2f0c90fbb4ac /cppuhelper/source
parentf0ed5d46373f34a78a260617cf22606f7fd3c399 (diff)
osl::Mutex->std::mutex in cppuhelper::ServiceManager
Change-Id: I2d30fb3c81e791eb554780b5abf4923a33cc884e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/servicemanager.cxx12
-rw-r--r--cppuhelper/source/servicemanager.hxx4
2 files changed, 8 insertions, 8 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 12167739da8d..1a0e85780b21 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -665,7 +665,7 @@ cppuhelper::ServiceManager::Data::Implementation::createInstance(
{
css::uno::Reference<css::uno::XInterface> inst;
if (isSingleInstance) {
- osl::MutexGuard g(mutex);
+ std::unique_lock g(mutex);
if (!singleInstance.is()) {
singleInstance = doCreateInstance(context);
}
@@ -684,7 +684,7 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(
{
css::uno::Reference<css::uno::XInterface> inst;
if (isSingleInstance) {
- osl::MutexGuard g(mutex);
+ std::unique_lock g(mutex);
if (!singleInstance.is()) {
singleInstance = doCreateInstanceWithArguments(context, arguments);
}
@@ -751,14 +751,14 @@ void cppuhelper::ServiceManager::Data::Implementation::updateDisposeInstance(
// at most one of the instances obtained via the service manager, in case
// the implementation hands out different instances):
if (singletonRequest) {
- osl::MutexGuard g(mutex);
+ std::unique_lock g(mutex);
disposeInstance.clear();
dispose = false;
} else if (shallDispose()) {
css::uno::Reference<css::lang::XComponent> comp(
instance, css::uno::UNO_QUERY);
if (comp.is()) {
- osl::MutexGuard g(mutex);
+ std::unique_lock g(mutex);
if (dispose) {
disposeInstance = comp;
}
@@ -891,7 +891,7 @@ void cppuhelper::ServiceManager::disposing() {
{
assert(rEntry.second);
if (rEntry.second->shallDispose()) {
- osl::MutexGuard g2(rEntry.second->mutex);
+ std::unique_lock g2(rEntry.second->mutex);
if (rEntry.second->disposeInstance.is()) {
sngls.push_back(rEntry.second->disposeInstance);
}
@@ -901,7 +901,7 @@ void cppuhelper::ServiceManager::disposing() {
{
assert(rEntry.second);
if (rEntry.second->shallDispose()) {
- osl::MutexGuard g2(rEntry.second->mutex);
+ std::unique_lock g2(rEntry.second->mutex);
if (rEntry.second->disposeInstance.is()) {
sngls.push_back(rEntry.second->disposeInstance);
}
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index 2228cd1fbbf1..b47d188ca82b 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -14,6 +14,7 @@
#include <cassert>
#include <unordered_map>
#include <memory>
+#include <mutex>
#include <string_view>
#include <vector>
@@ -29,7 +30,6 @@
#include <com/sun/star/uno/Reference.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx>
-#include <osl/mutex.hxx>
#include <rtl/ustring.hxx>
namespace com::sun::star::lang {
@@ -146,7 +146,7 @@ public:
css::uno::Reference< css::lang::XComponent > component;
Status status;
- osl::Mutex mutex;
+ std::mutex mutex;
css::uno::Reference<css::uno::XInterface> singleInstance;
css::uno::Reference< css::lang::XComponent > disposeInstance;
bool dispose;