It runs fine as a single thread (although 10% slower than if the computations are not run as a thread).
If it is only 10% then there's probably something seriously wrong with your code.It either doesn't lend itself very well to parallelization or the code is not written very well.Can you give us a compilable example?
If I have a global function Add(x,y) for example, and Add gets called in two threads at the same time, I am assuming that Add is run locally in each thread. Is that incorrect?
It's not enough to have thread one look only at array element , thread two to only work with element? The index specifies which element of the output array to change, so no two threads should ever change the same element of the array... even if somehow all 10k ran at once.
Thanks HeavyUser. This was the concept I was completely missing.How would you implement this?