comphelper/source/processfactory/processfactory.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 09dffa4cea17983748f9a2141bb311886e33b00b
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri May 13 11:08:18 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat May 14 12:35:30 2022 +0200

    use std::mutex in LocalProcessFactory
    
    which much faster than osl_Mutex, and especially for this simple case
    
    Change-Id: I4e8ba221649587af76c7f7cac5f308821490980a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134300
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/source/processfactory/processfactory.cxx 
b/comphelper/source/processfactory/processfactory.cxx
index ea5595646e4c..fc8586471db1 100644
--- a/comphelper/source/processfactory/processfactory.cxx
+++ b/comphelper/source/processfactory/processfactory.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <osl/mutex.hxx>
+#include <mutex>
 #include <comphelper/processfactory.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -41,19 +41,20 @@ class LocalProcessFactory {
 public:
     void set( const Reference< XMultiServiceFactory >& xSMgr )
     {
-        Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+        std::unique_lock aGuard( maMutex );
 
         xProcessFactory = xSMgr;
     }
 
     Reference< XMultiServiceFactory > get() const
     {
-        Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+        std::unique_lock aGuard( maMutex );
 
         return xProcessFactory;
     }
 
 private:
+    mutable std::mutex maMutex;
     Reference< XMultiServiceFactory > xProcessFactory;
 };
 

Reply via email to