[Libreoffice-commits] core.git: cppuhelper/source

Arnaud Versini (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 14 17:12:39 UTC 2021


 cppuhelper/source/implbase_ex.cxx |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

New commits:
commit c82914912f73f1fc9912d53fb60ca7a66379c560
Author:     Arnaud Versini <arnaud.versini at libreoffice.org>
AuthorDate: Sat Jun 5 13:38:14 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 14 19:12:01 2021 +0200

    cppuhelper : use std::mutex and remove useless rtl::Static
    
    Change-Id: Idb272e664c4b745c4db96e505b60905c93937900
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116746
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
index 00eeaf376618..24b7a74582d7 100644
--- a/cppuhelper/source/implbase_ex.cxx
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -24,28 +24,16 @@
 
 #include <com/sun/star/uno/RuntimeException.hpp>
 
+#include <mutex>
+
 using namespace ::cppu;
 using namespace ::osl;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-namespace
-{
-    class theImplHelperInitMutex : public rtl::Static<Mutex, theImplHelperInitMutex>{};
-}
-
 namespace cppu
 {
 
-/** Shared mutex for implementation helper initialization.
-    Not for public use.
-*/
-static ::osl::Mutex & getImplHelperInitMutex()
-{
-    return theImplHelperInitMutex::get();
-}
-
-
 static void checkInterface( Type const & rType )
 {
     if (TypeClass_INTERFACE != rType.getTypeClass())
@@ -79,7 +67,8 @@ static type_entry * getTypeEntries( class_data * cd )
     type_entry * pEntries = cd->m_typeEntries;
     if (! cd->m_storedTypeRefs) // not inited?
     {
-        MutexGuard guard( getImplHelperInitMutex() );
+        static std::mutex aMutex;
+        std::lock_guard guard( aMutex );
         if (! cd->m_storedTypeRefs) // not inited?
         {
             // get all types


More information about the Libreoffice-commits mailing list