#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx>
+#include <simgear/threads/SGGuard.hxx>
+
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/props/vectorPropTemplates.hxx>
Effect* SGMaterial::get_effect(const SGTexturedTriangleBin& triangleBin)
{
+ SGGuard<SGMutex> g(_lock);
if (_status.empty()) {
SG_LOG( SG_GENERAL, SG_WARN, "No effect available.");
return 0;
Effect* SGMaterial::get_effect()
{
+ SGGuard<SGMutex> g(_lock);
return get_effect(0);
}
}
#include <simgear/structure/SGSharedPtr.hxx>
+#include <simgear/threads/SGThread.hxx> // for SGMutex
#include <simgear/math/SGMath.hxx>
#include <simgear/bvh/BVHMaterial.hxx>
// Parameters from the materials file
const SGPropertyNode* parameters;
+ // per-material lock for entrypoints called from multiple threads
+ SGMutex _lock;
+
////////////////////////////////////////////////////////////////////
// Internal constructors and methods.
////////////////////////////////////////////////////////////////////