I have managed to enable simple multi-threading by using a lock, or mutual-exclusion (mutex) system. Basically, I lock around all Leadwerks commands, so that none of them can be called at the same time, and forcing them to execute sequentially.
This works really well for all commands. Except for the ones which create an entity, be it a body, model, mesh, light, etc.I'm wondering why that occurs, but most importantly, how can I truly create an entity on another thread.
I know I could invoke the entity to be created on the main thread (using a delegate that gets executed at the next loop), and this is the approach I've used so far. However, for many reasons, I would like to create entities on other threads.
How can I *truly* create entities on other threads without Leadwerks crashing?