Merge branch 'blender-v5.0-release'

This commit is contained in:
Jacques Lucke
2025-10-08 12:39:06 +02:00
2 changed files with 12 additions and 2 deletions

View File

@@ -82,7 +82,14 @@ class CacheMutex {
* This function is thread-safe under the assumption that the same parameters are passed from
* every thread.
*/
void ensure(FunctionRef<void()> compute_cache);
void ensure(const FunctionRef<void()> compute_cache)
{
/* Handle fast case when the cache is up-to-date. */
if (cache_valid_.load(std::memory_order_acquire)) {
return;
}
this->ensure_impl(compute_cache);
}
/**
* Reset the cache. The next time #ensure is called, it will recompute that code.
@@ -107,6 +114,9 @@ class CacheMutex {
{
return cache_valid_.load(std::memory_order_relaxed);
}
private:
void ensure_impl(FunctionRef<void()> compute_cache);
};
} // namespace blender

View File

@@ -11,7 +11,7 @@
namespace blender {
void CacheMutex::ensure(const FunctionRef<void()> compute_cache)
void CacheMutex::ensure_impl(const FunctionRef<void()> compute_cache)
{
if (cache_valid_.load(std::memory_order_acquire)) {
return;