Multithreaded safety. (KICAD-T5A)

This commit is contained in:
Jeff Young 2025-07-09 10:03:47 +01:00
parent 0f19ed5f9f
commit f097fbdfcc
2 changed files with 19 additions and 16 deletions

View File

@ -581,20 +581,18 @@ LSET allCuMask( int aCuLayerCount )
LSET LSET::AllCuMask( int aCuLayerCount ) LSET LSET::AllCuMask( int aCuLayerCount )
{ {
static LSET savedMax = allCuMask( MAX_CU_LAYERS );
static LSET cache;
static int cacheCuLayerCount = -1;
if( aCuLayerCount == MAX_CU_LAYERS ) if( aCuLayerCount == MAX_CU_LAYERS )
return savedMax; return AllCuMask();
if( aCuLayerCount != cacheCuLayerCount ) return allCuMask( aCuLayerCount );
{
cache = allCuMask( aCuLayerCount );
cacheCuLayerCount = aCuLayerCount;
} }
return cache;
LSET LSET::AllCuMask()
{
static LSET s_savedMax = allCuMask( MAX_CU_LAYERS );
return s_savedMax;
} }

View File

@ -117,7 +117,12 @@ public:
/** /**
* Return a mask holding the requested number of Cu PCB_LAYER_IDs. * Return a mask holding the requested number of Cu PCB_LAYER_IDs.
*/ */
static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS ); static LSET AllCuMask( int aCuLayerCount );
/**
* return AllCuMask( MAX_CU_LAYERS );
*/
static LSET AllCuMask();
/** /**
* Return a mask holding the Front and Bottom layers. * Return a mask holding the Front and Bottom layers.