The docs actually say about the
original - interrupted - thread (and not about the
interrupting one):
https://www.autohotkey.com/docs/misc/ErrorLevel.htm wrote: if the current thread is interrupted by another, when the original thread is resumed it will still have its original value of ErrorLevel, not the ErrorLevel that may have been set by the interrupting thread.
Also,
https://www.autohotkey.com/docs/misc/Threads.htm wrote:When the
current thread finishes, the one most recently interrupted will be resumed, and so on, until all the threads finally finish.
When resumed, a thread's settings for things such as
ErrorLevel and SendMode are automatically restored to what they were just prior to its interruption; in other words, a thread will experience no side-effects from having been interrupted (except for a possible change in the active window).
I understand it this way:
Code: Select all
F1::
Msgbox, % ErrorLevel:=123
msgbox % "F1 resumes: " ErrorLevel
Return
F2:: Msgbox, % ErrorLevel := 5
Press F1 ("current thread"), then F2 (F2's thread interrupts F1's thread), then close both initial msgboxes; F1's thread resumes.
The final msgbox of F1 still shows 123, although F2 has set its own Errorlevel to 5 in the meantime. Looks like it's documented, afaics.