diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-13 11:08:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-14 12:35:30 +0200 |
commit | 09dffa4cea17983748f9a2141bb311886e33b00b (patch) | |
tree | 38882ecd4482f30ecf253eebff6a3d0ec63de74c | |
parent | 624ad0d635bdd0a5d6734fca36ce2a87314e92ce (diff) |
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.grandin@collabora.co.uk>
-rw-r--r-- | comphelper/source/processfactory/processfactory.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
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; }; |