summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-02-20 17:34:38 +0100
committerGitHub <noreply@github.com>2023-02-20 17:34:38 +0100
commit9c960a8c2494eb826a557a7ffc96dd4547f9d31e (patch)
treef3cbb33a036a5db78c809ca150665e0e6cbc90bc /core
parentdfdda9629499271c447d4935b07e583650666600 (diff)
parentf42a837e921875b1cc090233b725dd94de145160 (diff)
Merge pull request #73628 from lawnjelly/bvh_mutex_fix
BVH - fix lockguards for multithread mode
Diffstat (limited to 'core')
-rw-r--r--core/math/bvh.h8
1 files changed, 2 insertions, 6 deletions
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<T, NUM_TREES, 2, MAX_ITEMS, USER_PAIR_TEST_FUNCTION, USER_CULL_TEST_FUNCTION, USE_PAIRS, BOUNDS, POINT>
-#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 T, int NUM_TREES = 1, bool USE_PAIRS = false, int MAX_ITEMS = 32, class USER_PAIR_TEST_FUNCTION = BVH_DummyPairTestFunction<T>, class USER_CULL_TEST_FUNCTION = BVH_DummyCullTestFunction<T>, 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;