Game Development Community

Threading / concurrency in Torque X

by Frederic · in Torque X 2D · 08/31/2007 (9:07 am) · 3 replies

Is there any support for concurrency in Torque X? Maybe any hidden synchronization wrapper class?

The API doc just states that "Instance members are not guaranteed to be thread-safe" (for all the classes I looked at), and I don't know if this is just an automatically generated statement (because it is also refering to Visual Basic) or a deliberately written down design decision by the Torque X developers.

XNA does not seem to be based on heavy use of threading, but the TorqueGame.SceneLoader.load() and unload() methods (which are in the GameUtil namespace which is unfortunately missing in the API doc) seem to operate asynchronously.

As I will definitely need to create my own threads, does it mean that I cannot actively call _any_ Torque X object's method from my concurrent threads?
Do I have to use a communication queue where I store my interaction requests, query it regularly from the Torque X thread and then do some callbacks? This wouldn't really make it easier to implement...

#1
09/13/2007 (9:29 am)
This matter is very important to my project, so it would be great if anyone could answer my question.

An answer of the form "yes, multithreding is supported - there are built-synchronization mechanisms in Torque X" or "no, Torque X is not designed for multithreading and therefore unsafe to use in such a context without explicit synchronizazion" would be enough.
#2
09/13/2007 (10:27 am)
No, in project multi-threading is not supported. You can of course use everything that XNA provides to create your own additional threads, but TorqueX itself is designed to be run in a single thread.
#3
09/13/2007 (2:56 pm)
Actually, several components were designed specifically with the possibility of threading in mind. Those systems include the render manager and the 3D rigid physics manager. That said, Torque X is currently unsafe to use in such a context without explicit synchronizazion.