Multi-threaded scripting

Is scripting in Ignition multi-threaded and if so, are there limitations to that. Is there ever a time where you would call a sleep function in a script and that would cause any of the basic system functions to hang up?

Scripting in Ignition is multi-threaded in certain locations. For example, Global Event Scripts Client and Gateway (timer scripts, tag change scripts, etc) are multi-threaded. However, event handlers on components run in the GUI thread by default. That means if you have a long running script on a actionPerformed, for example, it will hang the GUI until the script is finished. A lot of people don’t like that behavior because they can’t change screens or interact with the client untli the script is complete.

For that reason we have developed a couple of helper functions to run scripts in different threads. The main scripting function is system.util.invokeAsynchronous located at the following page in the user manual:

http://www.inductiveautomation.com/support/usermanuals/ignition/system_util_invokeasynchronous.htm

That function allows you to take any long running script and run it in a separate thread than the GUI thread. If you want your script to interact with the GUI you MUST call system.util.invokeLater. Take a look at the warning on the system.util.invokeAsynchronous function.

Now, if you are running a process in a separate thread you can simply call a sleep function to make it wait for some period of time. Here is an example:import time time.sleep(60)I hope this helps you out.