← Back to team overview

kicad-developers team mailing list archive

Re: Net names and net codes

 

Maciej,

Can you summarize to me how the function "Triangulation::createDelaunay(
nodes.begin(), nodes.end() )" works, and what are the data structures
involved?

I believe there are some dependencies in there.


On Tue, Jan 21, 2014 at 4:05 PM, Cirilo Bernardo
<cirilo_bernardo@xxxxxxxxx>wrote:

> >________________________________
> > From: Carl Poirier <carl.poirier.2@xxxxxxxxx>
> >To: Marco Serantoni <marco.serantoni@xxxxxxxxx>
> >Cc: Kicad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
> >Sent: Wednesday, January 22, 2014 3:51 AM
> >Subject: Re: [Kicad-developers] Net names and net codes
> >
> >
> >
> >There are some things in the code that don't like being multithreaded. If
> I parallelize the for loop in RN_DATA::Recalculate( int aNet ), I get a
> segfault. It does not happen if I put a lock to the call updateNet( i ),
> but obviously there is no increase in performance. I'm trying to find out
> what's the problem now.
> >
> >
> >
> This sounds to me like data is being altered by different threads and
> possibly there is some memory reallocation happening (growing arrays, etc).
> Locks are only needed when there is contention somewhere and of course
> locks should only be held for as short as needed. Another pitfall with
> threading is that some variables may need to be declared 'volatile' if they
> can be altered in another thread while one function is executing. For
> example, let's say the variable 'bool someX' can be altered in 2 threads;
> something like this can happen:
>
> 1. FunctionA starts, and runs a loop while(!someX) { ... }
> 2. FunctionB sets 'someX' to 'true'
> 3. FunctionA continues to run the loop, which is not the intended behavior
>
> Of course similar things can happen when using shared memory and forked
> processes.
>
> Threading has other problems to watch out for - for example, are there any
> static variables in functions? If so then you simply cannot thread those
> functions without locks.
>
> - Cirilo
>
>

Follow ups

References