MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / PauseCurrentThread

Method PauseCurrentThread

source/script.cpp:12517–12536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12515
12516
12517ResultType Line::PauseCurrentThread()
12518{
12519 // Pause the current subroutine (which by definition isn't paused since it had to be active
12520 // to call us). It seems best not to attempt to change the Hotkey mRunAgainAfterFinished
12521 // attribute for the current hotkey (assuming it's even a hotkey that got us here) or
12522 // for them all. This is because it's conceivable that this Pause command occurred
12523 // in a background thread, such as a timed subroutine, in which case we wouldn't want the
12524 // pausing of that thread to affect anything else the user might be doing with hotkeys.
12525 // UPDATE: The above is flawed because by definition the script's quasi-thread that got
12526 // us here is now active. Since it is active, the script will immediately become dormant
12527 // when this is executed, waiting for the user to press a hotkey to launch a new
12528 // quasi-thread. Thus, it seems best to reset all the mRunAgainAfterFinished flags
12529 // in case we are in a hotkey subroutine and in case this hotkey has a buffered repeat-again
12530 // action pending, which the user probably wouldn't want to happen after the script is unpaused:
12531 Hotkey::ResetRunAgainAfterFinished();
12532 g->IsPaused = true;
12533 ++g_nPausedThreads; // For this purpose the idle thread is counted as a paused thread.
12534 g_script.UpdateTrayIcon();
12535 return OK;
12536}
12537
12538
12539

Callers

nothing calls this directly

Calls 1

UpdateTrayIconMethod · 0.80

Tested by

no test coverage detected