mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Multi-threading safety.
(Possible fix for KICAD-74.)
This commit is contained in:
parent
2793bb1d68
commit
b76ef8c7e2
@ -189,6 +189,14 @@ void CONNECTIVITY_DATA::updateRatsnest()
|
|||||||
} );
|
} );
|
||||||
tp.wait_for_tasks();
|
tp.wait_for_tasks();
|
||||||
|
|
||||||
|
tp.push_loop( dirty_nets.size(),
|
||||||
|
[&]( const int a, const int b )
|
||||||
|
{
|
||||||
|
for( int ii = a; ii < b; ++ii )
|
||||||
|
dirty_nets[ii]->OptimizeRNEdges();
|
||||||
|
} );
|
||||||
|
tp.wait_for_tasks();
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
rnUpdate.Show();
|
rnUpdate.Show();
|
||||||
#endif
|
#endif
|
||||||
|
@ -328,7 +328,7 @@ void RN_NET::compute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RN_NET::optimizeRNEdges()
|
void RN_NET::OptimizeRNEdges()
|
||||||
{
|
{
|
||||||
auto optimizeZoneAnchor =
|
auto optimizeZoneAnchor =
|
||||||
[&]( const VECTOR2I& aPos, const LSET& aLayerSet,
|
[&]( const VECTOR2I& aPos, const LSET& aLayerSet,
|
||||||
@ -448,14 +448,6 @@ void RN_NET::UpdateNet()
|
|||||||
{
|
{
|
||||||
compute();
|
compute();
|
||||||
|
|
||||||
#ifdef PROFILE
|
|
||||||
PROF_TIMER cnt( "optimize" );
|
|
||||||
#endif
|
|
||||||
optimizeRNEdges();
|
|
||||||
#ifdef PROFILE
|
|
||||||
cnt.Show();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_dirty = false;
|
m_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,15 @@ public:
|
|||||||
* Recompute ratsnest for a net.
|
* Recompute ratsnest for a net.
|
||||||
*/
|
*/
|
||||||
void UpdateNet();
|
void UpdateNet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find optimal ends of RNEdges. The MST will have found the closest anchors, but when
|
||||||
|
* zones are involved we might have points closer than the anchors.
|
||||||
|
*
|
||||||
|
* Normally called after UpdateNet(), but from a separate multi-threaded loop for safety.
|
||||||
|
*/
|
||||||
|
void OptimizeRNEdges();
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
void AddCluster( std::shared_ptr<CN_CLUSTER> aCluster );
|
void AddCluster( std::shared_ptr<CN_CLUSTER> aCluster );
|
||||||
@ -94,10 +103,6 @@ protected:
|
|||||||
///< Compute the minimum spanning tree using Kruskal's algorithm
|
///< Compute the minimum spanning tree using Kruskal's algorithm
|
||||||
void kruskalMST( const std::vector<CN_EDGE> &aEdges );
|
void kruskalMST( const std::vector<CN_EDGE> &aEdges );
|
||||||
|
|
||||||
///< Find optimal ends of RNEdges. The MST will have found the closest anchors, but when
|
|
||||||
///< zones are involved we might have points closer than the anchors.
|
|
||||||
void optimizeRNEdges();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///< Vector of nodes
|
///< Vector of nodes
|
||||||
std::multiset<std::shared_ptr<CN_ANCHOR>, CN_PTR_CMP> m_nodes;
|
std::multiset<std::shared_ptr<CN_ANCHOR>, CN_PTR_CMP> m_nodes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user