diff --git a/lib/scene/rdl2/SceneContext.cc b/lib/scene/rdl2/SceneContext.cc index 811f55e..d9135b8 100644 --- a/lib/scene/rdl2/SceneContext.cc +++ b/lib/scene/rdl2/SceneContext.cc @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #include @@ -185,7 +185,7 @@ const rdl2::Camera* SceneContext::getPrimaryCamera() const { // Prevent possible race condition with mCameras.push_back() in createSceneObject(). - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); if (mCameras.size() == 0) { return nullptr; @@ -205,7 +205,7 @@ std::vector SceneContext::getCameras() const { // Prevent possible race condition with mCameras.push_back() in createSceneObject(). - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); std::vector cameras; @@ -236,7 +236,7 @@ std::vector SceneContext::getActiveCameras(void) const { // Prevent possible race condition with mCameras.push_back() in createSceneObject(). - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); std::vector cameras; @@ -447,16 +447,16 @@ SceneContext::createSceneObject(const std::string& className, // Do any type-specific setup. if (obj->isA()) { - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); mGeometries.push_back(obj->asA()); } else if (obj->isA()) { - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); mGeometrySets.push_back(obj->asA()); } else if (obj->isA()) { - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); mCameras.push_back(obj->asA()); } else if (obj->isA()) { - tbb::mutex::scoped_lock lock(mCreateSceneObjectMutex); + std::scoped_lock lock(mCreateSceneObjectMutex); mRenderOutputs.push_back(obj->asA()); } @@ -770,7 +770,7 @@ SceneContext::computeTimeRescalingCoeffs(float shutterOpen, float shutterClose, { // See declaration of TimeRescalingCoeffs in Types.h for details. - tbb::mutex::scoped_lock lock(mTimeRescalingCoeffsMutex); + std::scoped_lock lock(mTimeRescalingCoeffsMutex); MNRY_ASSERT_REQUIRE(motionSteps.size() >= 1 && motionSteps.size() <= 2); if (motionSteps.size() == 1 || motionSteps[0] == motionSteps[1]) { diff --git a/lib/scene/rdl2/SceneContext.h b/lib/scene/rdl2/SceneContext.h index 8b7c9ce..4735b13 100644 --- a/lib/scene/rdl2/SceneContext.h +++ b/lib/scene/rdl2/SceneContext.h @@ -13,7 +13,6 @@ #include #include #include -#include #include @@ -382,7 +381,7 @@ class SceneContext // it's being updated. In other words, doing an interpolated get() against // ANY object while the camera's shutter interval or SceneVariables motion // steps are being updated is a recipe for threading errors. - tbb::mutex mTimeRescalingCoeffsMutex; + std::mutex mTimeRescalingCoeffsMutex; // All cameras in the rdl context (including the primary camera). // This is in creation order. The primary camera can't be assumed to be @@ -414,7 +413,7 @@ class SceneContext // Mutex to sync write access to thread unsafe vectors like mGeometries only in // conditioning time. Those vectors will remain lock free for reading and reading / writing // at the same time is not allowed or protected in any way - mutable tbb::mutex mCreateSceneObjectMutex; + mutable std::mutex mCreateSceneObjectMutex; RenderOutputVector mRenderOutputs; std::string mDsoPath; diff --git a/lib/scene/rdl2/Shader.h b/lib/scene/rdl2/Shader.h index bb21139..265a761 100644 --- a/lib/scene/rdl2/Shader.h +++ b/lib/scene/rdl2/Shader.h @@ -86,7 +86,7 @@ class Shader : public SceneObject // Copy existing attributes into a cache void cacheAttributes() const { - tbb::mutex::scoped_lock lock(mCachedAttributesMutex); + std::scoped_lock lock(mCachedAttributesMutex); mCachedRequiredAttributes.clear(); if (!mRequiredAttributes.empty()) { @@ -127,7 +127,7 @@ class Shader : public SceneObject } void clearCachedAttributes() const { - tbb::mutex::scoped_lock lock(mCachedAttributesMutex); + std::scoped_lock lock(mCachedAttributesMutex); mCachedRequiredAttributes.clear(); mCachedOptionalAttributes.clear(); @@ -176,7 +176,7 @@ class Shader : public SceneObject /** * Mutex to protect the attribute caches. */ - mutable tbb::mutex mCachedAttributesMutex; + mutable std::mutex mCachedAttributesMutex; }; template <>