Multithreading

BlitzMax Forums/BlitzMax Programming/Multithreading

Twinprogrammer(Posted 2013) [#1]
Hey guys,

I was wondering if there is a way to utilize multithreading in Blitz Max, and if there is, is it a mod, or is it already in Blitz Max?


xlsior(Posted 2013) [#2]
It's already built in.

Works fairly well, with some limitations -- for example, you can only draw to the screen from the main program thread, the drawing commands aren't thread-safe. You can use most of the other commands in different threads, though. (game logic, network communications, etc.)


Twinprogrammer(Posted 2013) [#3]
Ok, cool. How do I use it, could you give me an example?


Hardcoal(Posted 2013) [#4]
example will be welcomed .. here as well


Twinprogrammer(Posted 2013) [#5]
I found a sample on multithreading, which is at the bottom of the samples list. REMEMBER TO RUN ON THREADED BUILD!


Twinprogrammer(Posted 2013) [#6]
I also found an example in the blitz max docs (not the manual on the website). Here's the example on the Blitz Max docs:




And here's the sample in the samples folder:



Hope this helps anyone else!


Hardcoal(Posted 2013) [#7]
thanks it does


Twinprogrammer(Posted 2013) [#8]
I realized that this only works when threaded build is on. Is there a way to change this? Because I want to give people my games just as an exe, not a .mt.exe file.


zzz(Posted 2013) [#9]
Just remove the .mt, it has no bearing on how the file is executed. I guess its just there so you can tell the compiled binaries apart.


Twinprogrammer(Posted 2013) [#10]
Oh... Stupid question :)