Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-10-13 06:31:02 +0300
committerHans Goudey <h.goudey@me.com>2022-10-13 06:31:50 +0300
commitc67e5628d22f8348492b6205081fe1798d50689c (patch)
tree01b7b5e46f080f0359c06b389d7d1a544279e325 /source/blender/blenkernel/intern/mesh_normals.cc
parent375dafe3ef40eb61e831902a1ae45ecca555fec6 (diff)
Cleanup: Use std::mutex for mesh runtime mutexes
Instead of allocating three separate ThreadMutex pointers, just embed std::mutex into the struct directly.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_normals.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh_normals.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index c2594ea3816..ebb5a72d137 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -356,11 +356,9 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3]
return nullptr;
}
- ThreadMutex *normals_mutex = (ThreadMutex *)mesh->runtime->normals_mutex;
- BLI_mutex_lock(normals_mutex);
+ std::lock_guard lock{mesh->runtime->normals_mutex};
if (!BKE_mesh_vertex_normals_are_dirty(mesh)) {
BLI_assert(mesh->runtime->vert_normals != nullptr);
- BLI_mutex_unlock(normals_mutex);
return mesh->runtime->vert_normals;
}
@@ -390,7 +388,6 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3]
BKE_mesh_poly_normals_clear_dirty(&mesh_mutable);
});
- BLI_mutex_unlock(normals_mutex);
return vert_normals;
}
@@ -405,11 +402,9 @@ const float (*BKE_mesh_poly_normals_ensure(const Mesh *mesh))[3]
return nullptr;
}
- ThreadMutex *normals_mutex = (ThreadMutex *)mesh->runtime->normals_mutex;
- BLI_mutex_lock(normals_mutex);
+ std::lock_guard lock{mesh->runtime->normals_mutex};
if (!BKE_mesh_poly_normals_are_dirty(mesh)) {
BLI_assert(mesh->runtime->poly_normals != nullptr);
- BLI_mutex_unlock(normals_mutex);
return mesh->runtime->poly_normals;
}
@@ -435,7 +430,6 @@ const float (*BKE_mesh_poly_normals_ensure(const Mesh *mesh))[3]
BKE_mesh_poly_normals_clear_dirty(&mesh_mutable);
});
- BLI_mutex_unlock(normals_mutex);
return poly_normals;
}