[Libreoffice-commits] core.git: cppu/source
Arnaud Versini (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jul 17 17:02:50 UTC 2021
cppu/source/threadpool/threadpool.cxx | 7 +++----
cppu/source/threadpool/threadpool.hxx | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
New commits:
commit bd4ee5ea9b0b79cfb8c03aa1f1d6008565b71bff
Author: Arnaud Versini <arnaud.versini at libreoffice.org>
AuthorDate: Sun Jun 27 17:05:35 2021 +0200
Commit: Arnaud Versini <arnaud.versini at libreoffice.org>
CommitDate: Sat Jul 17 19:02:18 2021 +0200
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 at libreoffice.org>
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;
};
More information about the Libreoffice-commits
mailing list