Thread Control Recommendations

On our most recent ignition project, I’ve been encountering a lot of issues with timing (tag reads would happen before information was available, or after I needed them, a sql tag would update after I needed it). At the time, I compensated with sleep timers. As time went on, I came to believe that many of these issues could be traced back to a habit of cramming large chunks of code in the event handlers. I’ve been told this is a BAD THING.

Searches on this forum and java.Swing both yielded recommendations to move long procedures to a background thread, and use event handlers for interacting with GUI elements only.

Unfortunately, I’m a little new to the idea of programming on multiple threads. It appears that my options for interacting with multiple threads are:

–Calling long procedures from Gateway or Client Events and interacting with component events via client tags.
–Use the InvokeAsynchronous method to call my long procedures from an event handler, such that they are executed on a background thread. Use InvokeLater from inside the long procedures to schedule updates to the GUI elements as new info becomes available.
–Figure how how SwingWorker works?
–Manually create and run new threads.

Does this sound about right? What is the preferred method for dealing with multiple threads in Ignition?

invokeAsync/invokeLater are probably the best way to go within an Ignition project.