| 1887 | |
| 1888 | |
| 1889 | void ResumeUnderlyingThread() |
| 1890 | { |
| 1891 | if (g->ThrownToken) |
| 1892 | g_script.FreeExceptionToken(g->ThrownToken); |
| 1893 | |
| 1894 | |
| 1895 | // The following section handles the switch-over to the former/underlying "g" item: |
| 1896 | --g_nThreads; // Other sections below might rely on this having been done early. |
| 1897 | --g; |
| 1898 | // The below relies on the above having restored "g" to be the global_struct of the underlying thread. |
| 1899 | |
| 1900 | // If the thread to be resumed was paused and has not been unpaused above, it will automatically be |
| 1901 | // resumed in a paused state because when we return from this function, we should be returning to |
| 1902 | // an instance of ExecUntil() (our caller), which should be in a pause loop still. Conversely, |
| 1903 | // if the thread to be resumed wasn't paused but was just paused above, the icon will be changed now |
| 1904 | // but the thread won't actually pause until ExecUntil() goes into its pause loop (which should be |
| 1905 | // immediately after the current command finishes, if execution is right in the middle of a command |
| 1906 | // due to the command having done a MsgSleep to allow a thread to interrupt). |
| 1907 | // Older comment: Always update the tray icon in case the paused state of the subroutine |
| 1908 | // we're about to resume is different from our previous paused state. Do this even |
| 1909 | // when the macro is used by CheckScriptTimers(), which although it might not technically |
| 1910 | // need it, lends maintainability and peace of mind. |
| 1911 | g_script.UpdateTrayIcon(); |
| 1912 | |
| 1913 | // If this was the last running thread and the script has nothing keeping it open (hotkeys, Gui, |
| 1914 | // message monitors, etc.) then it should terminate now: |
| 1915 | if (!g_OnExitIsRunning) |
| 1916 | g_script.ExitIfNotPersistent(EXIT_EXIT); |
| 1917 | } |
| 1918 | |
| 1919 | |
| 1920 |
no test coverage detected