C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
CacheManager< T > Class Template Reference

Manager for parallel data processing (the cache manager) with support of caches post-processing. More...

#include <tool_multithreading.h>

+ Inheritance diagram for CacheManager< T >:
+ Collaboration diagram for CacheManager< T >:

Public Member Functions

T * operator() ()
 Operator (). Returns a pointer to the cache (data) of the current thread. Always returns non-null value.
 
void Reset (bool resetLongTerm=false)
 Delete caches data. If resetLongTerm == true, also delete data of the main thread cache.
 
T * LongTerm ()
 Get a pointer to cache (data) of the main thread. Always returns non-null value. All operations with the main thread cache should be protected by the cache lock.
 
CommonMutexGetLock ()
 Get a pointer to the lock for operations with the main thread cache, considering whether the code runs in parallel. Can return null value (good for use with ScopedLock).
 
virtual bool ResetCacheData ()
 Cleaning function, used by the garbage collector.
 
virtual void HardReset ()
 Forced deletion of all caches (used by the garbage collector).
 
- Public Member Functions inherited from CacheCleaner
bool IsSubscribed ()
 Whether the object is subscribed for garbage collection.
 
void SubcribeOnCleaning ()
 Subscribe for garbage collection.
 
void UnsubcribeOnCleaning ()
 Unsubscribe from garbage collection.
 

Detailed Description

template<class T>
class CacheManager< T >

Manager for parallel data processing (the cache manager) with support of caches post-processing.

The cache manager is a template which contains: longTerm - data of the main thread in sequential execution, and tcache - a list of caches with data which are used in parallel calculations. Each thread uses its own copy of data according to threadKey. For multithreaded processing of dependent (with shared data) objects the multithreading mode mtm_SafeItems or higher should be used. The Manager provides a Postprocess() function for caches post-processing which is called after exiting parallel computing. The specified function iterates through the caches used in parallel computing and calls the function longTerm.MergeWith() with the data of the each cache as a parameter. After the function Postprocess() finished the caches are destroyed.


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