Explicitly separating execution

Assuming I have the following structure, where an initial “state” is created which includes “objects” (in my case, custom types consisting of values/arrays/tuples + vector of callback functions), and various functions that may call each other or modify the “objects” in various circumstances. For each subsequent iteration, i have multiple triggers, each of which modifies 1 part of the initial state in some way and may trigger a cascading series of modifications/evaluations via the chain of functions and callback functions in the initial state.

My question: how do I explicitly guarantee that all the evaluations initiated by trigger_1 are complete before trigger_2 is initiated? It seems logical to expect this, but I am not entirely sure how the code is being processed under the hood, and this is critical to the model working as designed.

# initialize state and interactive mechanisms
@eval begin
    obj1
    obj2
    obj3
   func1
   func2
   func3
   {etc...}
end

for i=1:100
    trigger_1(args...)
    trigger_2(args...)
end   

All code is run in sequential order, so you can always rely on statement-1 finishing before statement-2 begins

1 Like

As long as you don’t have external observer like another thread or a debugger.

1 Like