Blender V4.3
blender::CacheMutex Class Reference

#include <BLI_cache_mutex.hh>

Public Member Functions

void ensure (FunctionRef< void()> compute_cache)
 
void tag_dirty ()
 
bool is_dirty () const
 
bool is_cached () const
 

Detailed Description

Definition at line 68 of file BLI_cache_mutex.hh.

Member Function Documentation

◆ ensure()

void blender::CacheMutex::ensure ( FunctionRef< void()> compute_cache)

Make sure the cache exists and is up to date. This calls compute_cache once to update the cache (which is stored outside of this class) if it is dirty, otherwise it does nothing.

This function is thread-safe under the assumption that the same parameters are passed from every thread.

Definition at line 10 of file cache_mutex.cc.

References blender::threading::isolate_task(), and lock.

Referenced by blender::bke::node_tree_runtime::ensure_topology_cache().

◆ is_cached()

bool blender::CacheMutex::is_cached ( ) const
inline

Return true if the cache exists and is valid.

Definition at line 102 of file BLI_cache_mutex.hh.

Referenced by is_dirty().

◆ is_dirty()

bool blender::CacheMutex::is_dirty ( ) const
inline

Return true if the cache currently does not exist or has been invalidated.

Definition at line 94 of file BLI_cache_mutex.hh.

References is_cached().

◆ tag_dirty()

void blender::CacheMutex::tag_dirty ( )
inline

Reset the cache. The next time ensure is called, it will recompute that code.

Definition at line 86 of file BLI_cache_mutex.hh.


The documentation for this class was generated from the following files: