OpenMP (See... http://bisqwit.iki.fi/story/howto/openmp/#IntroductionToOpenmpInC ) has been around for a while now in C++, it allows C code to go multi-threaded with almost none of the usual source complications. I was thinking that this may integrate well with the GLB compiler, after all (in theory :P) you just insert some C++ compiler #pragmas to make a normal single threaded piece of source into a multi-threaded one. No extra C source modifications is are needed to support extra cores in your code.
The way OpenMP works is pretty simple, you mark out some pieces of code(using #pragmas) and then choose what method of threading you want the code to run under. So for example...
#pragma omp parallel
{
// Code inside this region runs in parallel.
printf("Hello!\n");
}
This would create 4 "Hello!"s on a quad core, or just 2 in a dual core system.
In GLB it may look like something like this...
THREADPARALLEL(TRUE)
STDOUT "Hello!\n"
THREADPARALLEL(FALSE)
Or whatever, the point is that the control of the threading model would be completely with the Basic coder. It would allow GLBasic to go completely multi-threaded without the usual complex in-line C++ when not using something like OpenMP.
Just a suggestion. :)
I think it´s very interesting, can use all cores of CPU, and if this works in mobile devices can be very usefull!!!
look at this thread: http://www.glbasic.com/forum/index.php?topic=3642.msg26493#msg26493
Quote from: Ocean on 2012-Jul-03
the threads-library works very well - have used it for more than a year now. Having said that, OpenMP offers a lot more than mere threads...
Yes I saw that lib too, OpenMP does offer a lot more and I thought that since it should be in theory only a matter of inserting some pragma codes in the GLB generated C code with some extra compiler command line options, it may be feasible to add it to GLBasics compile chain. It would certainly bring GLB bang up to date with multicore processing IMHO.
but you need a compiler that supports it. :)
GCC support is there and it's built into XCode as a project option too.