04-10-2023, 03:54 AM
(04-06-2023, 08:54 PM)dISP Wrote: That's an interesting idea because it would be pretty universal. Different types of CPU's on the same OS would get the the same OS distribution. I had thought about using the chain command for the same idea but wasn't sure if I could get chains to run concurrently.
Still, it would be simpler if I could simply ask my single program to use multiple physical cores. Even if there are no real qb64 commands, I have to believe their is a way for qb64 to ask MS windows how many cores I have and to use them. But, I am not experienced with accessing MS windows from qb64.
https://qb64phoenix.com/qb64wiki/index.p..._Libraries
It's not possible in QB64, at least not in any reliable fashion, the best you can do is have multiple completely separate programs that run at the same time and communicate.
Like was mentioned, what you really want is threading support - you would create multiple threads in your program and then Windows/Linux/etc. will schedule them to run on whatever cores are available to the system. However while it's technically possible to create new threads via some
Declare Librarycalls if you know the right magic, it won't work for very long because QB64 is not design for this and none of the functionality is thread-safe. Meaning, you cannot have two threads in your program running QB64 code at the same time, the various internal structures will eventually end-up corrupted.