Re: Multithreading question


Bob Jacobsen
 

I’m really not sure what you mean by ' calls the method object.execute() on the GUI thread’, but the usual way to do this is to use standard methods to run `object.execute()` _later_ on the thread. You queue is as a later action on the GUI thread:

https://www.jmri.org/JavaDoc/doc/jmri/util/ThreadingUtil.html#runOnGUIEventually-jmri.util.ThreadingUtil.ThreadAction-

"Run some GUI-specific code at some later point.
If invoked from the GUI thread, the work is guaranteed to happen only after the current routine has returned."

By doing it later, it serializes anything that might otherwise be a recursion.

Bob

On Oct 3, 2019, at 4:47 PM, danielb987 <db123@...> wrote:

I have a method ConditionalNG.execute() that may be called from any thread. This method calls the method object.execute() on the GUI thread. The method object.execute() calls other methods that in turn may call the method ConditionalNG.execute().
--
Bob Jacobsen
@BobJacobsen

Join jmri@jmri-developers.groups.io to automatically receive all group messages.