simon.wade_ Posted October 15, 2012 Posted October 15, 2012 I was wondering about the behaviour of the thread() function in UnigineScript. As far as I can tell from the documentation, creating a new thread queues a function to be called after the current update cycle, and then using the wait keyword suspends execution until after the next update cycle. Hence you end up with a function called per-frame. If this is correct, then there's less need to serialize any data access between each thread and the update cycle, as this interleaved process naturally gives some level of serialization. However, I'm sure it's still possible to make a mess of things if you start deleting or modifying objects on the main thread. So, my two questions are: Is my description of the threading behaviour more or less accurate? Has anybody looked in to thread safety issues? Thanks!
ulf.schroeter Posted October 15, 2012 Posted October 15, 2012 Your assumptions are correct. Script thread functions are invoked in a serialized manner by the application main thread. It's comparable top early-days windows 3.1 cooperative threading.
Recommended Posts