BLI: Add dirty and cached checks to shared cache
While these aren't needed that often, it can be helpful to avoid using a cache if it isn't necessary and it doesn't already exist.
This commit is contained in:
@@ -64,6 +64,22 @@ template<typename T> class SharedCache {
|
||||
BLI_assert(cache_->mutex.is_cached());
|
||||
return cache_->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the cache currently does not exist or has been invalidated.
|
||||
*/
|
||||
bool is_dirty() const
|
||||
{
|
||||
return cache_->mutex.is_dirty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the cache exists and is valid.
|
||||
*/
|
||||
bool is_cached() const
|
||||
{
|
||||
return cache_->mutex.is_cached();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace blender
|
||||
|
||||
Reference in New Issue
Block a user