Salome HOME
Ensure cmake_build_type is used in SALOME 9.12.0
[tools/sat_salome.git] / products / patches / openturns-1.21.0003.patch
1 --- openturns-1.21_ref/otrobopt-0.12/lib/src/MeasureEvaluation.cxx      2023-09-13 14:59:42.000000000 +0200
2 +++ openturns-1.21_ref/otrobopt-0.12/lib/src/MeasureEvaluation.cxx      2023-09-26 12:11:25.339902064 +0200
3 @@ -23,40 +23,20 @@
4  #include <openturns/PersistentObjectFactory.hxx>
5  #include <openturns/ResourceMap.hxx>
6  #include <openturns/GaussKronrodRule.hxx>
7 +#include <mutex>
8  
9  using namespace OT;
10  
11  namespace OTROBOPT
12  {
13  
14 -
15 -static pthread_mutex_t OTRobOptResourceMap_InstanceMutex_;
16 -static UnsignedInteger OTRobOptResourceMap_initialized_ = 0;
17 -
18 -class OTRobOptResourceMap_init
19 +struct OTRobOptResourceMap_init
20  {
21 -public:
22    OTRobOptResourceMap_init()
23    {
24 -
25 -    if (!OTRobOptResourceMap_initialized_)
26 +    static std::once_flag flag;
27 +    std::call_once(flag, [&]()
28      {
29 -#ifndef OT_MUTEXINIT_NOCHECK
30 -      pthread_mutexattr_t attr;
31 -      pthread_mutexattr_init( &attr );
32 -      pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
33 -      pthread_mutex_init(&OTRobOptResourceMap_InstanceMutex_, &attr);
34 -#else
35 -      pthread_mutex_init(&OTRobOptResourceMap_InstanceMutex_, NULL);
36 -#endif
37 -      // openturns<1.15
38 -#ifndef OPENTURNS_VERSION
39 -#define AddAsScalar SetAsScalar
40 -#define AddAsUnsignedInteger SetAsUnsignedInteger
41 -#define AddAsBool SetAsBool
42 -#define AddAsScalar SetAsScalar
43 -#endif
44 -      // SequentialMonteCarloRobustAlgorithm
45        ResourceMap::AddAsScalar("SequentialMonteCarloRobustAlgorithm-ConvergenceFactor", 1e-2);
46        ResourceMap::AddAsUnsignedInteger("SequentialMonteCarloRobustAlgorithm-DefaultInitialSamplingSize", 10);
47  
48 @@ -67,21 +47,11 @@
49  
50        ResourceMap::AddAsUnsignedInteger("IndividualChanceMeasure-GaussKronrodRule", GaussKronrodRule::G7K15);
51        ResourceMap::AddAsUnsignedInteger("JointChanceMeasure-GaussKronrodRule", GaussKronrodRule::G7K15);
52 -      OTRobOptResourceMap_initialized_ = 1;
53 -    }
54 -    assert(OTRobOptResourceMap_initialized_);
55 +    });
56    }
57 -
58 -  ~OTRobOptResourceMap_init()
59 -  {
60 -    if (OTRobOptResourceMap_initialized_)
61 -      pthread_mutex_destroy(&OTRobOptResourceMap_InstanceMutex_);
62 -    OTRobOptResourceMap_initialized_ = 0;
63 -  }
64 -
65  };
66  
67 -static const OTRobOptResourceMap_init static_initializer_OTRobOptResourceMap;
68 +static const OTRobOptResourceMap_init __OTRobOptResourceMap_initializer;
69  
70  CLASSNAMEINIT(MeasureEvaluation)
71