rtl : use a local std::mutex instead of the global mutex

Change-Id: I95a35fe451e459276dcb8c9b90d515d0a34fe36c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138318
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Arnaud VERSINI
2022-08-16 09:25:31 +02:00
committed by Noel Grandin
parent a20fa9bbbf
commit 3329bfe698
+4 -2
View File
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <mutex>
#include <string.h>
#include <stdlib.h>
#include <osl/mutex.hxx>
#include <rtl/random.h>
#include <rtl/uuid.h>
#include <rtl/digest.h>
@@ -108,7 +108,9 @@ extern "C" void SAL_CALL rtl_createUuid(sal_uInt8 *pTargetUUID ,
return aPool;
}();
osl::MutexGuard g(osl::Mutex::getGlobalMutex());
static std::mutex aMutex;
std::scoped_lock g(aMutex);
if (rtl_random_getBytes(pool, pTargetUUID, 16) != rtl_Random_E_None)
{
abort();