summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2021-06-27 17:05:35 +0200
committerArnaud Versini <arnaud.versini@libreoffice.org>2021-07-17 19:02:18 +0200
commitbd4ee5ea9b0b79cfb8c03aa1f1d6008565b71bff (patch)
tree2980f67a3c2f9b62e8d1ed2908ce9dc9ae61b178 /cppu
parent3581de4d1d7dc3910b4642a2baef534dcd882597 (diff)
cppu : use std::mutex in DisposedCallerAdmin
Change-Id: I3db567a9aed42167ea24eebcf673f19106595f83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117948 Tested-by: Jenkins Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/threadpool/threadpool.cxx7
-rw-r--r--cppu/source/threadpool/threadpool.hxx2
2 files changed, 4 insertions, 5 deletions
diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx
index 257155027955..86c280b4b352 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -25,7 +25,6 @@
#include <unordered_map>
#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <sal/log.hxx>
@@ -68,19 +67,19 @@ namespace cppu_threadpool
void DisposedCallerAdmin::dispose( void const * nDisposeId )
{
- MutexGuard guard( m_mutex );
+ std::scoped_lock guard( m_mutex );
m_vector.push_back( nDisposeId );
}
void DisposedCallerAdmin::destroy( void const * nDisposeId )
{
- MutexGuard guard( m_mutex );
+ std::scoped_lock guard( m_mutex );
m_vector.erase(std::remove(m_vector.begin(), m_vector.end(), nDisposeId), m_vector.end());
}
bool DisposedCallerAdmin::isDisposed( void const * nDisposeId )
{
- MutexGuard guard( m_mutex );
+ std::scoped_lock guard( m_mutex );
return (std::find(m_vector.begin(), m_vector.end(), nDisposeId) != m_vector.end());
}
diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx
index 5b758703579a..15d092a21062 100644
--- a/cppu/source/threadpool/threadpool.hxx
+++ b/cppu/source/threadpool/threadpool.hxx
@@ -89,7 +89,7 @@ namespace cppu_threadpool {
bool isDisposed( void const * nDisposeId );
private:
- ::osl::Mutex m_mutex;
+ std::mutex m_mutex;
std::vector< void const * > m_vector;
};