| 08-02-2009, 04:57 PM | #1 |
Does ExecuteFunc still guarantee sequential operation? I would like to call it from a loop (a group enumeration actually), and have some globals that I would like to set to pass as arguments to the function each time it's called. Can I be sure that the global will have the correct value for each execution of the code? Example: JASS:function func1 takes nothing returns nothing set udg_int = 1 call ExecuteFunc("func2") set udg_int = 2 call ExecuteFunc("func2") endfunction function func2 takes nothing returns nothing call BJDebugMsg(I2S(udg_int)) endfunction The basic question is will this always display "1" then "2"? No waits will be involved. Obviously, I tested it for this simple case, but I'm wondering if it always holds true, or if doing this repeatedly in a long loop or with more complicated code in between that would require more execution time would prevent this from working. |
| 08-02-2009, 08:30 PM | #2 |
The ExecuteFunc'd thread will interrupt the executing thread, which will only resume after the executed thread finishes (or hits a wait). |
| 08-02-2009, 08:37 PM | #3 |
Great. So without waits, it functions exactly like normal function calls in terms of sequential execution. |
| 08-02-2009, 09:10 PM | #4 |
Correct you are. |
| 08-02-2009, 09:13 PM | #5 |
there are no async threads in jass. (in fact there is only 1 thread) |
