There are 10 threads in this demo (9 of them dynamically starts and exists (or aborts)):
+ main thread where actually created device and running it
- - here we call Generate() any time we want to regenerate fractal view, it aborts 1+8 threads if needed, calculates new fractal window for each tile, marks each tile as "not ready" and start new tile manager thread;
- here we call DrawAll() for fractal, it draws all tiles which are ready);
+ 8 single tile generator threads (each one generates a small tile: locks texture, generates, ready to be aborted anytime and unlock texture at "finally" "try-catch"s part /* this is important */);
On my i7 it loads CPU on 100% while generating tiles. Each tile is 64x64 texture. Tiles created once and sorted in the way: who is closer to the center of the screen - goes first /* after this invention, fractal browsing became much more comfortable (before this, i generated all from left to right and from top to bottom - quite boring) */. All the calculation is done using "double" type, it gives a bit more ability to zoom-in in comparison to "float". Also I don't clear the background in driver.BeginScene(), that adds some smooth and also some traces when you move.