PDA

View Full Version : Asynchronous processing on host - is it possible?



SilentRuin
October 12th, 2020, 19:08
Is there a way for me to create and spawn another thread running in the background of Fantasy Grounds Unity?

I just did an experiment in an OnInit kicking off an OOB message that did a few sleeps then printed out when I was exiting OnInit. It was pretty much locked to one thread and did not show my exiting message until I was completely done with the OOB call. I had thought I'd seen some OOB stuff in my logs show that they were processing like they were asynchronous in other extensions. But now I wonder if they were just an illusion of logging or if OnInit is just a special case?

So is there a way to kick off an asynchronous thread in Fantasy Grounds? I thought it was OOB but it appears that is not the case. At least from OnInit.

Moon Wizard
October 12th, 2020, 21:01
No, the Lua engine state has to be kept synchronous with the UI engine state in order for things to work as expected, and thus runs in the same thread. There is no mechanism for background threads.

Regards,
JPG

SilentRuin
October 12th, 2020, 22:07
No, the Lua engine state has to be kept synchronous with the UI engine state in order for things to work as expected, and thus runs in the same thread. There is no mechanism for background threads.

Regards,
JPG

Thanks - I'll just have to get creative then :)