change m_CachesMutex to shared_mutex and do shared locking for read access in zone BBox calculations

This commit is contained in:
Armin Schoisswohl
2024-03-07 13:20:13 +00:00
committed by Jeff Young
parent 991ff71f33
commit bb9448edcb
7 changed files with 43 additions and 27 deletions
+6 -6
View File
@@ -57,12 +57,12 @@ public:
// in the ENUM_MAP: one for the canonical layer name and one for the user layer name.
// We need to check against both.
wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
const wxString& layerName = b->AsString();
BOARD* board = static_cast<PCBEXPR_CONTEXT*>( aCtx )->GetBoard();
std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
auto i = board->m_LayerExpressionCache.find( layerName );
LSET mask;
wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
const wxString& layerName = b->AsString();
BOARD* board = static_cast<PCBEXPR_CONTEXT*>( aCtx )->GetBoard();
std::unique_lock<std::shared_mutex> cacheLock( board->m_CachesMutex );
auto i = board->m_LayerExpressionCache.find( layerName );
LSET mask;
if( i == board->m_LayerExpressionCache.end() )
{