Multithread and loading?

BlitzMax Forums/MiniB3D Module/Multithread and loading?

ima747(Posted 2009) [#1]
I know iMinib3d currently doesn't support multithreading ,but how hard would it be to implement this, specifically to be able to load resources on one thread and have the program running on another.

i.e. game is running, you go towards a door, the game sees that the next room is not loaded yet, rather than pausing for a load when you hit the door, it could pre-load the next room in the background so that when you reach the door the room may already be loaded and it would be a minimal wait to swap meshes rather than having to pause and load...

or even more simply, you could load on one thread and update a progress bar, or show a loading animation on another...

Not very familiar with multithreading in this fashion, I'm sure there's memory headaches (what if I try to access something while it's loading, but a simple flag saying whether it's done yet or not would cover that I think...) etc. just curious how this might be gone about. Most modern systems either have multiple cores, or atleast enough extra processor time to handle another thread for loading while keeping the main program running plenty smooth...