C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
tool_mutex.h File Reference

Locks implementation on base of system synchronization mechanisms and OpenMP locks. details Implementation of locks (including scoped lock) on base of system synchronization mechanisms and OpenMP locks.
. More...

#include <math_define.h>

Classes

class  CommonMutex
 Lock class. More...
 
class  ParallelRegionGuard
 Scoped guard of parallel region. More...
 
class  ScopedLock
 Scoped lock. Can accept a null pointer to a mutex. Locking occurs if the pointer to the mutex is nonzero and the code runs in parallel. More...
 
class  ScopedRecursiveLock
 Recursive scoped lock. Can accept a null pointer to a mutex. Locking occurs if the pointer to the mutex is nonzero and the code runs in parallel. More...
 
class  MbSyncItem
 Base synchronization object with lazy initialization. More...
 
class  MbNestSyncItem
 Base synchronization object with lazy initialization which supports nested locks. More...
 
class  MbPersistentSyncItem
 Base object providing means of synchronization. More...
 
class  MbPersistentNestSyncItem
 Base synchronization object with support of nested locks. More...
 

Macros

#define CommonRecursiveMutex   CommonMutex
 Same implementation of CommonMutex and CommonRecursiveMutex.
 
#define ENTER_PARALLEL(useParallel)   if ( useParallel ) EnterParallelRegion();
 If useParallel == true, notifies the kernel about entering a parallel region. More...
 
#define EXIT_PARALLEL(useParallel)   if ( useParallel ) ExitParallelRegion();
 If useParallel == true, notifies the kernel about exiting a parallel region. More...
 
#define ENTER_PARALLEL_FORCED   EnterParallelRegion();
 Notifies the kernel about entering a parallel region. More...
 
#define EXIT_PARALLEL_FORCED   ExitParallelRegion();
 Notifies the kernel about exiting a parallel region. More...
 
#define SET_MEMORY_SCOPED_LOCK   ScopedRecursiveLock memScopedLock( GetGlobalRecursiveLock() );
 Set scoped lock for memory allocation and deallocation operations.
 

Enumerations

enum  MbeMultithreadedMode { mtm_Off = 0 , mtm_Standard = 1 , mtm_SafeItems = 2 , mtm_Items = 3 , mtm_Max = 31 }
 Multithreading modes. More...
 

Functions

void EnterParallelRegion ()
 The function notifies the kernel about entering a parallel region. The function call should be placed before the start of a parallel block.
 
void ExitParallelRegion ()
 The function notifies the kernel about exiting a parallel region. The function call should be placed after the end of the parallel block.
 
bool IsInParallel ()
 The function determines whether the code is executed in parallel.
 
bool CacheCleanupAllowed ()
 The function determines whether the caches cleanup is allowed.
 
bool IsSafeMultithreading ()
 Whether is enabled a safe multithreading mode (used in CacheManager).
 
bool LocksEnabled ()
 Whether locks are enabled (multithreading is on and code is executed in parallel).
 
unsigned int GetThreadKey ()
 Get a current thread pseudo-identifier.
 
CommonMutexGetGlobalLock ()
 Get a pointer to the global mutex (used in CacheManager).
 
CommonMutexGetGlobalRecursiveLock ()
 Get a pointer to the global recursive mutex (used for memory allocation and deallocation operations).
 

Detailed Description

Locks implementation on base of system synchronization mechanisms and OpenMP locks. details Implementation of locks (including scoped lock) on base of system synchronization mechanisms and OpenMP locks.
.

Macro Definition Documentation

◆ ENTER_PARALLEL

#define ENTER_PARALLEL (   useParallel)    if ( useParallel ) EnterParallelRegion();

If useParallel == true, notifies the kernel about entering a parallel region.

If useParallel == true, notifies the kernel about entering a parallel region. The call should be placed before the start of a parallel block (before OpenMP pragma). Using a macro speeds up parallel OpenMP cycles significantly.

◆ EXIT_PARALLEL

#define EXIT_PARALLEL (   useParallel)    if ( useParallel ) ExitParallelRegion();

If useParallel == true, notifies the kernel about exiting a parallel region.

If useParallel == true, notifies the kernel about exiting a parallel region. The call should be placed after the end of the parallel block. Using a macro speeds up parallel OpenMP cycles significantly.

◆ ENTER_PARALLEL_FORCED

#define ENTER_PARALLEL_FORCED   EnterParallelRegion();

Notifies the kernel about entering a parallel region.

Notifies the kernel about entering a parallel region. The call should be placed before the start of a parallel block (before OpenMP pragma). Using a macro speeds up parallel OpenMP cycles significantly.

◆ EXIT_PARALLEL_FORCED

#define EXIT_PARALLEL_FORCED   ExitParallelRegion();

Notifies the kernel about exiting a parallel region.

Notifies the kernel about exiting a parallel region. The call should be placed after the end of the parallel block. Using a macro speeds up parallel OpenMP cycles significantly.