Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit a3bc159

Browse files
committed
IfcOpenShell#1173 mutex in get_default_style()
1 parent 7d75613 commit a3bc159

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/ifcgeom_schema_agnostic/SurfaceStyle.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <boost/property_tree/ptree.hpp>
55

66
#include <map>
7+
#include <mutex>
78

89
namespace pt = boost::property_tree;
910

@@ -112,6 +113,9 @@ void IfcGeom::set_default_style_file(const std::string& json_file) {
112113
}
113114

114115
const IfcGeom::SurfaceStyle* IfcGeom::get_default_style(const std::string& s) {
116+
static std::mutex m;
117+
std::lock_guard<std::mutex> lk(m);
118+
115119
if (!default_materials_initialized) InitDefaultMaterials();
116120
std::map<std::string, IfcGeom::SurfaceStyle>::const_iterator it = default_materials.find(s);
117121
if (it == default_materials.end()) {

0 commit comments

Comments
 (0)