Basic Parallel Programming Questions

Basic Parallel Programming Questions
I have a mapping application which does a TranparentBlt to combine several bitmap layers (e.g. roads, towns, state borders etc) to create the map. Rendering each layer takes time, so I thought this would be a wonderful task for the new Parallel library in XE7.  It's a simple For loop to go though each layer and call "Render", but for some reason the parallel version misses details on the map.  Then I find when I set breakpoints in the code to executed in the for loop, they don't fire!

So my questions are:

1. Is there anything you shouldn't do in a parallel for-loop? I'm creating independent bitmaps (i.e. each one is not dependent upon any other), so I wouldn't have thought I need to "lock" anything. Am I correct?

2. I assume a parallel for-loop waits for everything to be executed before continuing execution of the code. Is this correct? Or are we just firing off a loop of tasks to complete and continuing the execution of the code?

3. If you can't set breakpoints in parallel code, how do you debug it? Any tips appreciated!

Steve

Comments