will we ever get multi threading in BlitzMax?

BlitzMax Forums/BlitzMax Programming/will we ever get multi threading in BlitzMax?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Handling with threads could be simplified, i.E. take this example from C# which uses the Parallel Extions Library from MS and ist quite similar to Threading Building Blocks from Intel:

                    Parallel.For(0, height, j =>
                    {
                        PixelData* outPixel = fastOut.GetInitialPixelForRow(j);
                        PixelData* startPixel = fastStart.GetInitialPixelForRow(j);
                        PixelData* endPixel = fastEnd.GetInitialPixelForRow(j);

                        for (int i = 0; i < width; i++)
                        {
                            // Blend the input pixels into the output pixel
                            outPixel->R = (byte)((startPixel->R * blend) + .5 + (endPixel->R * (1 - blend))); // .5 for rounding
                            outPixel->G = (byte)((startPixel->G * blend) + .5 + (endPixel->G * (1 - blend)));
                            outPixel->B = (byte)((startPixel->B * blend) + .5 + (endPixel->B * (1 - blend)));

                            outPixel++;
                            startPixel++;
                            endPixel++;
                        }
                    });


The secret lies in the library, the library knows:
- how many cores are availaible
- which granularity to use

It creates itself the ideal amount of threads an speeds up near to linearity. To use parallelis in constructs, where it could easily done - is much more error safe and easier to develop like an "real" threaded game where you have an extra renderthread, ai-threa, physics-thread, io-thread....