From f42a837e921875b1cc090233b725dd94de145160 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Mon, 20 Feb 2023 15:15:18 +0000 Subject: BVH - fix lockguards for multithread mode Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call. This is fixed, and the warning message for contention is removed as multithread mode seems to be desired in production in 4.x. --- core/math/bvh.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/math/bvh.h b/core/math/bvh.h index ea8289607e..8fbbd8e7fd 100644 --- a/core/math/bvh.h +++ b/core/math/bvh.h @@ -55,7 +55,7 @@ #include "core/os/mutex.h" #define BVHTREE_CLASS BVH_Tree -#define BVH_LOCKED_FUNCTION BVHLockedFunction(&_mutex, BVH_THREAD_SAFE &&_thread_safe); +#define BVH_LOCKED_FUNCTION BVHLockedFunction _lock_guard(&_mutex, BVH_THREAD_SAFE &&_thread_safe); template , class USER_CULL_TEST_FUNCTION = BVH_DummyCullTestFunction, class BOUNDS = AABB, class POINT = Vector3, bool BVH_THREAD_SAFE = true> class BVH_Manager { @@ -779,11 +779,7 @@ private: // will be compiled out if not set in template if (p_thread_safe) { _mutex = p_mutex; - - if (!_mutex->try_lock()) { - WARN_PRINT("Info : multithread BVH access detected (benign)"); - _mutex->lock(); - } + _mutex->lock(); } else { _mutex = nullptr; -- cgit v1.2.3